mirror of
https://github.com/Garux/netradiant-custom.git
synced 2026-09-28 00:00:03 +02:00
tweak plane3_translated()
This commit is contained in:
+3
-9
@@ -75,15 +75,9 @@ inline Plane3 plane3_normalised( const Plane3& plane ){
|
||||
);
|
||||
}
|
||||
|
||||
inline Plane3 plane3_translated( const Plane3& plane, const Vector3& translation ){
|
||||
Plane3 transformed;
|
||||
transformed.a = plane.a;
|
||||
transformed.b = plane.b;
|
||||
transformed.c = plane.c;
|
||||
transformed.d = -( ( -plane.d * transformed.a + translation.x() ) * transformed.a +
|
||||
( -plane.d * transformed.b + translation.y() ) * transformed.b +
|
||||
( -plane.d * transformed.c + translation.z() ) * transformed.c );
|
||||
return transformed;
|
||||
template<typename T>
|
||||
Plane3 plane3_translated( const Plane3& plane, const BasicVector3<T>& translation ){
|
||||
return Plane3( plane.normal(), vector3_dot( plane.normal(), plane.normal() * plane.dist() + translation ) );
|
||||
}
|
||||
|
||||
inline Plane3 plane3_transformed( const Plane3& plane, const Matrix4& transform ){
|
||||
|
||||
+5
-6
@@ -606,8 +606,7 @@ inline void planepts_print( const PlanePoints& planePoints, TextOutputStream& os
|
||||
|
||||
|
||||
inline Plane3 Plane3_applyTranslation( const Plane3& plane, const Vector3& translation ){
|
||||
Plane3 tmp( plane3_translated( Plane3( plane.normal(), -plane.dist() ), translation ) );
|
||||
return Plane3( tmp.normal(), -tmp.dist() );
|
||||
return plane3_translated( plane, translation );
|
||||
}
|
||||
|
||||
inline Plane3 Plane3_applyTransform( const Plane3& plane, const Matrix4& matrix ){
|
||||
@@ -732,11 +731,11 @@ public:
|
||||
}
|
||||
void offset( float offset ){
|
||||
if ( !isDoom3Plane() ) {
|
||||
Vector3 move( vector3_scaled( m_planeCached.normal(), -offset ) );
|
||||
const DoubleVector3 move( m_planeCached.normal() * offset );
|
||||
|
||||
vector3_subtract( m_planepts[0], move );
|
||||
vector3_subtract( m_planepts[1], move );
|
||||
vector3_subtract( m_planepts[2], move );
|
||||
m_planepts[0] += move;
|
||||
m_planepts[1] += move;
|
||||
m_planepts[2] += move;
|
||||
|
||||
MakePlane();
|
||||
}
|
||||
|
||||
@@ -2169,10 +2169,10 @@ Vector3 Camera_getFocusPos( camera_t& camera ){
|
||||
#endif
|
||||
|
||||
const Plane3 frustumPlanes[4] = {
|
||||
plane3_translated( view.getFrustum().left, camorigin - aabb.origin ),
|
||||
plane3_translated( view.getFrustum().right, camorigin - aabb.origin ),
|
||||
plane3_translated( view.getFrustum().top, camorigin - aabb.origin ),
|
||||
plane3_translated( view.getFrustum().bottom, camorigin - aabb.origin ),
|
||||
plane3_translated( view.getFrustum().left, aabb.origin - camorigin ),
|
||||
plane3_translated( view.getFrustum().right, aabb.origin - camorigin ),
|
||||
plane3_translated( view.getFrustum().top, aabb.origin - camorigin ),
|
||||
plane3_translated( view.getFrustum().bottom, aabb.origin - camorigin ),
|
||||
};
|
||||
float offset = 64.0f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user