mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- changed all model related references to level.
This commit is contained in:
parent
8652f140f2
commit
473892dede
7 changed files with 19 additions and 18 deletions
|
@ -160,7 +160,7 @@ void hw_GetDynModelLight(AActor *self, FDynLightData &modellightdata)
|
|||
float radiusSquared = (float)(self->renderradius * self->renderradius);
|
||||
dl_validcount++;
|
||||
|
||||
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
|
||||
BSPWalkCircle(self->Level, x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
|
||||
{
|
||||
auto section = subsector->section;
|
||||
if (section->validcount == dl_validcount) return; // already done from a previous subsector.
|
||||
|
|
|
@ -122,7 +122,7 @@ void PolyModelRenderer::AddLights(AActor *actor)
|
|||
float z = (float)actor->Center();
|
||||
float radiusSquared = (float)(actor->renderradius * actor->renderradius);
|
||||
|
||||
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
|
||||
BSPWalkCircle(actor->Level, x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
|
||||
{
|
||||
FLightNode * node = subsector->section->lighthead;
|
||||
while (node) // check all lights touching a subsector
|
||||
|
|
|
@ -167,13 +167,13 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s
|
|||
objectToWorldMatrix.rotate(-smf->rolloffset, 1, 0, 0);
|
||||
|
||||
// consider the pixel stretching. For non-voxels this must be factored out here
|
||||
float stretch = (smf->modelIDs[0] != -1 ? Models[smf->modelIDs[0]]->getAspectFactor() : 1.f) / actor->Level->info->pixelstretch;
|
||||
float stretch = (smf->modelIDs[0] != -1 ? Models[smf->modelIDs[0]]->getAspectFactor(actor->Level) : 1.f) / actor->Level->info->pixelstretch;
|
||||
objectToWorldMatrix.scale(1, stretch, 1);
|
||||
|
||||
float orientation = scaleFactorX * scaleFactorY * scaleFactorZ;
|
||||
|
||||
BeginDrawModel(actor, smf, objectToWorldMatrix, orientation < 0);
|
||||
RenderFrameModels(smf, actor->state, actor->tics, actor->GetClass(), translation);
|
||||
RenderFrameModels(actor->Level, smf, actor->state, actor->tics, actor->GetClass(), translation);
|
||||
EndDrawModel(actor, smf);
|
||||
}
|
||||
|
||||
|
@ -211,11 +211,11 @@ void FModelRenderer::RenderHUDModel(DPSprite *psp, float ofsX, float ofsY)
|
|||
float orientation = smf->xscale * smf->yscale * smf->zscale;
|
||||
|
||||
BeginDrawHUDModel(playermo, objectToWorldMatrix, orientation < 0);
|
||||
RenderFrameModels(smf, psp->GetState(), psp->GetTics(), playermo->player->ReadyWeapon->GetClass(), 0);
|
||||
RenderFrameModels(playermo->Level, smf, psp->GetState(), psp->GetTics(), playermo->player->ReadyWeapon->GetClass(), 0);
|
||||
EndDrawHUDModel(playermo);
|
||||
}
|
||||
|
||||
void FModelRenderer::RenderFrameModels(const FSpriteModelFrame *smf, const FState *curState, const int curTics, const PClass *ti, int translation)
|
||||
void FModelRenderer::RenderFrameModels(FLevelLocals *Level, const FSpriteModelFrame *smf, const FState *curState, const int curTics, const PClass *ti, int translation)
|
||||
{
|
||||
// [BB] Frame interpolation: Find the FSpriteModelFrame smfNext which follows after smf in the animation
|
||||
// and the scalar value inter ( element of [0,1) ), both necessary to determine the interpolated frame.
|
||||
|
@ -229,7 +229,7 @@ void FModelRenderer::RenderFrameModels(const FSpriteModelFrame *smf, const FStat
|
|||
// [BB] To interpolate at more than 35 fps we take tic fractions into account.
|
||||
float ticFraction = 0.;
|
||||
// [BB] In case the tic counter is frozen we have to leave ticFraction at zero.
|
||||
if (ConsoleState == c_up && menuactive != MENU_On && !level.isFrozen())
|
||||
if (ConsoleState == c_up && menuactive != MENU_On && !Level->isFrozen())
|
||||
{
|
||||
ticFraction = I_GetTimeFrac();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ FTextureID LoadSkin(const char * path, const char * fn);
|
|||
|
||||
struct FSpriteModelFrame;
|
||||
class IModelVertexBuffer;
|
||||
struct FLevelLocals;
|
||||
|
||||
enum ModelRendererType
|
||||
{
|
||||
|
@ -81,7 +82,7 @@ public:
|
|||
virtual void DrawElements(int numIndices, size_t offset) = 0;
|
||||
|
||||
private:
|
||||
void RenderFrameModels(const FSpriteModelFrame *smf, const FState *curState, const int curTics, const PClass *ti, int translation);
|
||||
void RenderFrameModels(FLevelLocals *Level, const FSpriteModelFrame *smf, const FState *curState, const int curTics, const PClass *ti, int translation);
|
||||
};
|
||||
|
||||
struct FModelVertex
|
||||
|
@ -138,7 +139,7 @@ public:
|
|||
virtual void RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame, int frame2, double inter, int translation=0) = 0;
|
||||
virtual void BuildVertexBuffer(FModelRenderer *renderer) = 0;
|
||||
virtual void AddSkins(uint8_t *hitlist) = 0;
|
||||
virtual float getAspectFactor() { return 1.f; }
|
||||
virtual float getAspectFactor(FLevelLocals *) { return 1.f; }
|
||||
|
||||
void SetVertexBuffer(FModelRenderer *renderer, IModelVertexBuffer *buffer) { mVBuf[renderer->GetType()] = buffer; }
|
||||
IModelVertexBuffer *GetVertexBuffer(FModelRenderer *renderer) const { return mVBuf[renderer->GetType()]; }
|
||||
|
@ -407,7 +408,7 @@ public:
|
|||
virtual void AddSkins(uint8_t *hitlist);
|
||||
FTextureID GetPaletteTexture() const { return mPalette; }
|
||||
void BuildVertexBuffer(FModelRenderer *renderer);
|
||||
float getAspectFactor();
|
||||
float getAspectFactor(FLevelLocals *) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -502,12 +503,12 @@ void BSPNodeWalkCircle(void *node, float x, float y, float radiusSquared, const
|
|||
|
||||
// Search BSP for subsectors within the given radius and call callback(subsector) for each found
|
||||
template<typename Callback>
|
||||
void BSPWalkCircle(float x, float y, float radiusSquared, const Callback &callback)
|
||||
void BSPWalkCircle(FLevelLocals *Level, float x, float y, float radiusSquared, const Callback &callback)
|
||||
{
|
||||
if (level.nodes.Size() == 0)
|
||||
callback(&level.subsectors[0]);
|
||||
if (Level->nodes.Size() == 0)
|
||||
callback(&Level->subsectors[0]);
|
||||
else
|
||||
BSPNodeWalkCircle(level.HeadNode(), x, y, radiusSquared, callback);
|
||||
BSPNodeWalkCircle(Level->HeadNode(), x, y, radiusSquared, callback);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -383,9 +383,9 @@ int FVoxelModel::FindFrame(const char * name)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
float FVoxelModel::getAspectFactor()
|
||||
float FVoxelModel::getAspectFactor(FLevelLocals *Level)
|
||||
{
|
||||
return level.info->pixelstretch;
|
||||
return Level->info->pixelstretch;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -492,7 +492,7 @@ void R_InterpolateView (FRenderViewpoint &viewpoint, player_t *player, double Fr
|
|||
}
|
||||
else
|
||||
{
|
||||
DVector2 disp = level.Displacements.getOffset(oldgroup, newgroup);
|
||||
DVector2 disp = viewpoint.ViewLevel->Displacements.getOffset(oldgroup, newgroup);
|
||||
viewpoint.Pos = iview->Old.Pos + (iview->New.Pos - iview->Old.Pos - disp) * Frac;
|
||||
viewpoint.Path[0] = viewpoint.Path[1] = iview->New.Pos;
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace swrenderer
|
|||
float z = (float)actor->Center();
|
||||
float radiusSquared = (float)(actor->renderradius * actor->renderradius);
|
||||
|
||||
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
|
||||
BSPWalkCircle(actor->Level, x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
|
||||
{
|
||||
FLightNode * node = subsector->section->lighthead;
|
||||
while (node) // check all lights touching a subsector
|
||||
|
|
Loading…
Reference in a new issue