diff options
author | aap <aap@papnet.eu> | 2020-04-15 22:36:21 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-04-15 22:36:21 +0200 |
commit | afce2e1bb3212a01efe0205313cf5d632eee8a20 (patch) | |
tree | e9602e11ba49ad3cd35c0af4355eec330d73aa8b /src/render/Glass.cpp | |
parent | implemented most of librw wrapper (diff) | |
parent | Merge pull request #440 from Fire-Head/master (diff) | |
download | re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.gz re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.bz2 re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.lz re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.xz re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.zst re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.zip |
Diffstat (limited to 'src/render/Glass.cpp')
-rw-r--r-- | src/render/Glass.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp index 41d31985..ac6c1728 100644 --- a/src/render/Glass.cpp +++ b/src/render/Glass.cpp @@ -404,6 +404,7 @@ CGlass::AskForObjectToBeRenderedInGlass(CEntity *entity) void CGlass::RenderEntityInGlass(CEntity *entity) { + ASSERT(entity!=nil); CObject *object = (CObject *)entity; if ( object->bGlassBroken ) @@ -419,7 +420,7 @@ CGlass::RenderEntityInGlass(CEntity *entity) uint8 alpha = CalcAlphaWithNormal(&fwdNorm); CColModel *col = object->GetColModel(); - + ASSERT(col!=nil); if ( col->numTriangles >= 2 ) { CVector a = object->GetMatrix() * col->vertices[0]; @@ -523,6 +524,8 @@ CGlass::RenderEntityInGlass(CEntity *entity) int32 CGlass::CalcAlphaWithNormal(CVector *normal) { + ASSERT(normal!=nil); + float fwdDir = 2.0f * DotProduct(*normal, TheCamera.GetForward()); float fwdDot = DotProduct(TheCamera.GetForward()-fwdDir*(*normal), CVector(0.57f, 0.57f, -0.57f)); return int32(lerp(fwdDot*fwdDot*fwdDot*fwdDot*fwdDot*fwdDot, 20.0f, 255.0f)); @@ -597,6 +600,8 @@ CGlass::RenderReflectionPolys(void) void CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, CVector point, bool explosion) { + ASSERT(entity!=nil); + CObject *object = (CObject *)entity; if ( object->bGlassBroken ) @@ -605,7 +610,8 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, object->bGlassCracked = true; CColModel *col = object->GetColModel(); - + ASSERT(col!=nil); + CVector a = object->GetMatrix() * col->vertices[0]; CVector b = object->GetMatrix() * col->vertices[1]; CVector c = object->GetMatrix() * col->vertices[2]; @@ -647,6 +653,8 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, void CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount) { + ASSERT(entity!=nil); + CObject *object = (CObject *)entity; if ( amount > 50.0f && !object->bGlassCracked ) @@ -659,6 +667,8 @@ CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount) void CGlass::WasGlassHitByBullet(CEntity *entity, CVector point) { + ASSERT(entity!=nil); + CObject *object = (CObject *)entity; if ( IsGlass(object->GetModelIndex()) ) @@ -679,6 +689,8 @@ CGlass::WasGlassHitByBullet(CEntity *entity, CVector point) void CGlass::WindowRespondsToExplosion(CEntity *entity, CVector point) { + ASSERT(entity!=nil); + CObject *object = (CObject *)entity; CVector distToGlass = object->GetPosition() - point; |