diff options
author | /dev/humancontroller <devhc@example.com> | 2014-07-13 21:04:47 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:14 +0100 |
commit | eb95d5b561d44d5ead7d9f524f6cf449add9eac1 (patch) | |
tree | 2a941daa25f18f307c1a6f45803d86b38be00ff8 /src/cgame | |
parent | 02f195684a11b0791c68ef9ffcfa714188ba6a9b (diff) |
also invalidate the buildable orientation cache if the angles or the buildable type changes
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_buildable.c | 6 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 2c85bfd7..33a3cc0e 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -1321,7 +1321,9 @@ void CG_Buildable( centity_t *cent ) // seeing as buildables rarely move, we cache the results and recalculate // only if the buildable moves or changes orientation if( VectorCompare( cent->buildableCache.cachedOrigin, cent->lerpOrigin ) && - VectorCompare( cent->buildableCache.cachedNormal, surfNormal ) ) + VectorCompare( cent->buildableCache.cachedAngles, cent->lerpAngles ) && + VectorCompare( cent->buildableCache.cachedNormal, surfNormal ) && + cent->buildableCache.cachedType == es->modelindex ) { VectorCopy( cent->buildableCache.axis[ 0 ], ent.axis[ 0 ] ); VectorCopy( cent->buildableCache.axis[ 1 ], ent.axis[ 1 ] ); @@ -1338,7 +1340,9 @@ void CG_Buildable( centity_t *cent ) VectorCopy( ent.axis[ 2 ], cent->buildableCache.axis[ 2 ] ); VectorCopy( ent.origin, cent->buildableCache.origin ); VectorCopy( cent->lerpOrigin, cent->buildableCache.cachedOrigin ); + VectorCopy( cent->lerpAngles, cent->buildableCache.cachedAngles ); VectorCopy( surfNormal, cent->buildableCache.cachedNormal ); + cent->buildableCache.cachedType = es->modelindex; } } else diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index ab160784..0d73474a 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -606,8 +606,10 @@ typedef struct buildableStatus_s typedef struct buildableCache_s { - vec3_t cachedOrigin; // If either the cached entity origin or the - vec3_t cachedNormal; // cached surfNormal change the cache is invalid + vec3_t cachedOrigin; // If any of the values differ from their + vec3_t cachedAngles; // cached versions, then the cache is invalid + vec3_t cachedNormal; + buildable_t cachedType; vec3_t axis[ 3 ]; vec3_t origin; } buildableCache_t; |