More mixed d&c fixes

This commit is contained in:
mazmazz 2018-12-26 23:50:35 -05:00
parent 78adb69481
commit d5a0b2df4d
2 changed files with 12 additions and 5 deletions

View file

@ -233,6 +233,8 @@ typedef struct
// Load the model // Load the model
model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat) model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
{ {
FILE *f;
model_t *retModel = NULL; model_t *retModel = NULL;
md2header_t *header; md2header_t *header;
@ -247,6 +249,10 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
const float WUNITS = 1.0f; const float WUNITS = 1.0f;
float dataScale = WUNITS; float dataScale = WUNITS;
md2triangle_t *tris;
md2texcoord_t *texcoords;
md2frame_t *frames;
int t; int t;
// MD2 currently does not work with tinyframes, so force useFloat = true // MD2 currently does not work with tinyframes, so force useFloat = true
@ -263,7 +269,7 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
useFloat = true; useFloat = true;
FILE *f = fopen(fileName, "rb"); f = fopen(fileName, "rb");
if (!f) if (!f)
return NULL; return NULL;
@ -316,9 +322,9 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
// float dataScale = WUNITS; // float dataScale = WUNITS;
// Tris and ST are simple structures that can be straight-copied // Tris and ST are simple structures that can be straight-copied
md2triangle_t *tris = (md2triangle_t*)&buffer[header->offsetTris]; tris = (md2triangle_t*)&buffer[header->offsetTris];
md2texcoord_t *texcoords = (md2texcoord_t*)&buffer[header->offsetST]; texcoords = (md2texcoord_t*)&buffer[header->offsetST];
md2frame_t *frames = (md2frame_t*)&buffer[header->offsetFrames]; frames = (md2frame_t*)&buffer[header->offsetFrames];
// Read in textures // Read in textures
retModel->numMaterials = header->numSkins; retModel->numMaterials = header->numSkins;

View file

@ -1827,12 +1827,13 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
{ {
float *vertPtr; float *vertPtr;
float *normPtr; float *normPtr;
int j = 0;
// Dangit, I soooo want to do this in a GLSL shader... // Dangit, I soooo want to do this in a GLSL shader...
AllocLerpBuffer(mesh->numVertices * sizeof(float) * 3); AllocLerpBuffer(mesh->numVertices * sizeof(float) * 3);
vertPtr = vertBuffer; vertPtr = vertBuffer;
normPtr = normBuffer; normPtr = normBuffer;
int j = 0; //int j = 0;
for (j = 0; j < mesh->numVertices * 3; j++) for (j = 0; j < mesh->numVertices * 3; j++)
{ {