mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-25 23:25:40 +00:00
Added a clear() method to VBORef and removed unsafe memset() clear.
This commit is contained in:
parent
3b41239cfb
commit
69610ef8dd
|
@ -631,8 +631,7 @@ struct VBORef *CRender3D::BeginModel(ModelCache *Cache)
|
|||
Cache->curVertIdx[i] = 0;
|
||||
|
||||
// Clear the VBO reference to 0 and clear texture references
|
||||
memset(Model, 0, sizeof(VBORef) - sizeof(CTextureRefs));
|
||||
Model->texRefs.Clear();
|
||||
Model->Clear();
|
||||
|
||||
// Record starting index of first opaque polygon in VBO (alpha poly index will be re-set in EndModel())
|
||||
Model->index[POLY_STATE_NORMAL] = Cache->vboCurOffset/(VBO_VERTEX_SIZE*sizeof(GLfloat));
|
||||
|
|
|
@ -78,6 +78,25 @@ struct VBORef
|
|||
UINT16 texOffset; // texture offset data for this model
|
||||
|
||||
CTextureRefs texRefs; // unique texture references contained in this model
|
||||
|
||||
/*
|
||||
* Clear():
|
||||
*
|
||||
* Clears the VBORef by setting all fields to 0 and clearing the texture
|
||||
* references.
|
||||
*/
|
||||
inline void Clear(void)
|
||||
{
|
||||
texRefs.Clear();
|
||||
lutIdx = 0;
|
||||
texOffset = 0;
|
||||
nextTexOffset = NULL;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
index[i] = 0;
|
||||
numVerts[i] = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Display list items: model instances and viewport settings
|
||||
|
|
Loading…
Reference in a new issue