mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- use a TArray to store the sprite model hash to get rid of one atterm call.
This commit is contained in:
parent
313ec62a5c
commit
0aeaed4207
2 changed files with 7 additions and 31 deletions
|
@ -53,7 +53,7 @@ EXTERN_CVAR (Bool, r_drawvoxels)
|
|||
extern TDeletingArray<FVoxel *> Voxels;
|
||||
extern TDeletingArray<FVoxelDef *> VoxelDefs;
|
||||
|
||||
DeletingModelArray Models;
|
||||
TDeletingArray<FModel*> Models;
|
||||
|
||||
void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *smf, AActor *actor, double ticFrac)
|
||||
{
|
||||
|
@ -314,15 +314,9 @@ void FModel::DestroyVertexBuffer()
|
|||
}
|
||||
|
||||
static TArray<FSpriteModelFrame> SpriteModelFrames;
|
||||
static int * SpriteModelHash;
|
||||
static TArray<int> SpriteModelHash;
|
||||
//TArray<FStateModelFrame> StateModelFrames;
|
||||
|
||||
static void DeleteModelHash()
|
||||
{
|
||||
if (SpriteModelHash != nullptr) delete [] SpriteModelHash;
|
||||
SpriteModelHash = nullptr;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FindGFXFile
|
||||
|
@ -489,13 +483,9 @@ static void ParseModelDefLump(int Lump);
|
|||
|
||||
void InitModels()
|
||||
{
|
||||
for (unsigned i = 0; i < Models.Size(); i++)
|
||||
{
|
||||
delete Models[i];
|
||||
}
|
||||
Models.Clear();
|
||||
Models.DeleteAndClear();
|
||||
SpriteModelFrames.Clear();
|
||||
DeleteModelHash();
|
||||
SpriteModelHash.Clear();
|
||||
|
||||
// First, create models for each voxel
|
||||
for (unsigned i = 0; i < Voxels.Size(); i++)
|
||||
|
@ -548,9 +538,8 @@ void InitModels()
|
|||
}
|
||||
|
||||
// create a hash table for quick access
|
||||
SpriteModelHash = new int[SpriteModelFrames.Size ()];
|
||||
atterm(DeleteModelHash);
|
||||
memset(SpriteModelHash, 0xff, SpriteModelFrames.Size () * sizeof(int));
|
||||
SpriteModelHash.Resize(SpriteModelFrames.Size ());
|
||||
memset(SpriteModelHash.Data(), 0xff, SpriteModelFrames.Size () * sizeof(int));
|
||||
|
||||
for (unsigned int i = 0; i < SpriteModelFrames.Size (); i++)
|
||||
{
|
||||
|
|
|
@ -462,21 +462,8 @@ FSpriteModelFrame * FindModelFrame(const PClass * ti, int sprite, int frame, boo
|
|||
bool IsHUDModelForPlayerAvailable(player_t * player);
|
||||
void FlushModels();
|
||||
|
||||
class DeletingModelArray : public TArray<FModel *>
|
||||
{
|
||||
public:
|
||||
|
||||
~DeletingModelArray()
|
||||
{
|
||||
for (unsigned i = 0; i<Size(); i++)
|
||||
{
|
||||
delete (*this)[i];
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
extern DeletingModelArray Models;
|
||||
extern TDeletingArray<FModel*> Models;
|
||||
|
||||
// Check if circle potentially intersects with node AABB
|
||||
inline bool CheckBBoxCircle(float *bbox, float x, float y, float radiusSquared)
|
||||
|
|
Loading…
Reference in a new issue