QD3D: TQ3TexturingMode: opaque, alphatest, alphablend

This commit is contained in:
Iliyas Jorio 2021-02-21 10:54:57 +01:00
parent 4b6df39318
commit 98a72ecdbd
3 changed files with 17 additions and 6 deletions

View File

@ -172,9 +172,11 @@ uint32_t Q3MetaFileParser::Parse1Chunk()
if (currentMesh)
{
Assert(!currentMesh->hasTexture, "txmm: current mesh already has a texture");
Assert(currentMesh->internalTextureID < 0, "txmm: current mesh already has a texture");
Assert(currentMesh->texturingMode == kQ3TexturingModeOff, "txmm: current mesh already has a texturing mode");
currentMesh->internalTextureID = internalTextureID;
currentMesh->hasTexture = true;
currentMesh->texturingMode = kQ3TexturingModeInvalid; // set texturing mode to invalid because we don't know if the texture is opaque yet
}
break;

View File

@ -160,8 +160,8 @@ TQ3TriMeshData* Q3TriMeshData_New(int numTriangles, int numPoints)
mesh->vertexUVs = __Q3Alloc<TQ3Param2D>(numPoints, 'TMuv');
mesh->vertexColors = nullptr;
mesh->diffuseColor = {1, 1, 1, 1};
mesh->hasTexture = false;
mesh->textureHasTransparency = false;
mesh->texturingMode = kQ3TexturingModeOff;
mesh->internalTextureID = -1;
for (int i = 0; i < numPoints; i++)
{

View File

@ -47,6 +47,16 @@ typedef enum
kQ3StatusSize32 = 0xFFFFFFFF
} TQ3Status;
// WARNING: this enum did not exist in QD3D
typedef enum
{
kQ3TexturingModeInvalid = -1,
kQ3TexturingModeOff = 0,
kQ3TexturingModeOpaque,
kQ3TexturingModeAlphaTest,
kQ3TexturingModeAlphaBlend,
kQ3TexturingModeSize32 = 0xFFFFFFFF,
} TQ3TexturingMode;
enum TQ3AttributeTypes
{
@ -266,8 +276,7 @@ typedef struct TQ3TriMeshData
TQ3BoundingBox bBox;
bool hasTexture;
bool textureHasTransparency; // TODO
TQ3TexturingMode texturingMode;
int internalTextureID;
uint32_t glTextureName;