GLuint CC3MeshNode::findFirstGlobal( GLuint maxHitCount, CC3MeshIntersection* intersections, CC3Ray aRay, bool acceptBackFaces, bool acceptBehind ) { if ( !_mesh ) return 0; // Convert the array to local coordinates and find intersections. CC3Ray localRay = getGlobalTransformMatrixInverted()->transformRay( aRay ); GLuint hitCount = findFirst( maxHitCount, intersections, localRay, acceptBackFaces, acceptBehind ); // Convert the intersections to global coordinates. for (GLuint hitIdx = 0; hitIdx < hitCount; hitIdx++) { CC3MeshIntersection* hit = &intersections[hitIdx]; hit->location = getGlobalTransformMatrix()->transformLocation( hit->location ); hit->distance = hit->location.distance( aRay.startLocation ); } return hitCount; }
void CC3MeshNode::setGlobalLightPosition( const CC3Vector4& aPosition ) { CC3Vector4 localLtPos = getGlobalTransformMatrixInverted()->transformHomogeneousVector( aPosition ); getMaterial()->setLightDirection( localLtPos.cc3Vector() ); super::setGlobalLightPosition( aPosition ); }
CC3Matrix* CC3Camera::getViewMatrix() { return getGlobalTransformMatrixInverted(); }