[Add] Flag for invisible stuff.

This commit is contained in:
Allanis 2017-11-19 00:09:17 +00:00
parent f043889fe9
commit 7bd0b17cb7
5 changed files with 18 additions and 9 deletions

View File

@ -89,6 +89,7 @@ void InfoView::Draw3D(void) {
m.z1 = -rot[2]; m.z2 = -rot[6]; m.z3 = rot[10];
const ShipType& stype = L3D::player->GetShipType();
sbreSetDepthRange(L3D::GetScrWidth()*0.5f, 0.0f, 1.0f);
sbreRenderModel(&p, &m, stype.sbreModel, &params);
glPopAttrib();
}

View File

@ -88,6 +88,11 @@ static void ResolveVertices(Model* pMod, Vector* pRes, ObjParams* pObjParam) {
static float g_dn, g_df, g_sd;
static int g_wireframe = 0;
float SBRE_ZBIAS = 0;
void sbreSetZBias(float zbias) {
SBRE_ZBIAS = zbias;
}
void sbreSetDepthRange(float sd, float dn, float df) {
glDepthRange(dn+SBRE_ZBIAS, df);

View File

@ -102,6 +102,7 @@ static int PrimFuncZBias(uint16* pData, Model* pMod, RState* pState) {
}
static int PrimFuncTriFlat(uint16* pData, Model* pMod, RState* pState) {
if(pData[0] & RFLAG_INVISIBLE) return 4;
Vector* pVtx = pState->pVtx;
Vector* pVec;
Vector norm, tv1, tv2;
@ -133,6 +134,7 @@ static int PrimFuncTriFlat(uint16* pData, Model* pMod, RState* pState) {
}
static int PrimFuncQuadFlat(uint16* pData, Model* pMod, RState* pState) {
if(pData[0] & RFLAG_INVISIBLE) return 5;
Vector* pVtx = pState->pVtx;
Vector* pVec;
Vector norm, tv1, tv2;

View File

@ -1,5 +1,4 @@
#pragma once
#include "jjtypes.h"
#include "jjvector.h"
enum animsrc {
@ -16,7 +15,7 @@ enum animflag {
struct ObjParams {
float pAnim[10];
uint8 pFlag[10];
unsigned char pFlag[10];
float linthrust[3]; /* 1.0 to -1.0 */
float angthrust[3]; /* 1.0 to -1.0 */
@ -46,6 +45,7 @@ struct CollMesh {
* sd is screen depth in pixels, dn and df are like glDepthRange params.
*/
void sbreSetDepthRange(float sd, float dn, float df);
void sbreSetZBias(float zbias);
void sbreSetViewport(int w, int h, float d, float zn, float zf, float dn, float df);
void sbreSetDirLight(float* pColor, float* pDir);
void sbreSetWireframe(int val);

View File

@ -150,16 +150,17 @@ extern int (*pPrimFuncTable[])(uint16*, Model*, RState*);
extern int (*pCollFuncTable[])(uint16*, Model*, RState*);
static const int RFLAG_XREF = 0x8000;
static const int RFLAG_INVISIBLE = 0x4000;
static const int SUBOBJ_THRUST = 0x4000;
static const int THRUST_XREF = 0x8000;
static const int THRUST_NOANG = 0x4000;
/* Proper value for 16-bit depth buffer. */
//static const float SBRE_ZBIAS = 0.00002f;
static const float SBRE_ZBIAS = 0.00002f;
static const float SBRE_AMB = 0.3f;
extern float SBRE_ZBIAS;
enum comptype {
COMP_END = 0,
COMP_LINE,