MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getCameraReflection

Method getCameraReflection

Engine/source/scene/reflector.cpp:786–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

784}
785
786MatrixF PlaneReflector::getCameraReflection( const MatrixF &camTrans )
787{
788 Point3F normal = refplane;
789
790 // Figure out new cam position
791 Point3F camPos = camTrans.getPosition();
792 F32 dist = refplane.distToPlane( camPos );
793 Point3F newCamPos = camPos - normal * dist * 2.0;
794
795 // Figure out new look direction
796 Point3F i, j, k;
797 camTrans.getColumn( 0, &i );
798 camTrans.getColumn( 1, &j );
799 camTrans.getColumn( 2, &k );
800
801 i = MathUtils::reflect( i, normal );
802 j = MathUtils::reflect( j, normal );
803 k = MathUtils::reflect( k, normal );
804 //mCross( i, j, &k );
805
806
807 MatrixF newTrans(true);
808 newTrans.setColumn( 0, i );
809 newTrans.setColumn( 1, j );
810 newTrans.setColumn( 2, k );
811
812 newTrans.setPosition( newCamPos );
813
814 return newTrans;
815}
816
817inline F32 sgn(F32 a)
818{

Callers

nothing calls this directly

Calls 6

reflectFunction · 0.85
distToPlaneMethod · 0.80
getColumnMethod · 0.80
setColumnMethod · 0.80
getPositionMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected