/////////////////////////////////////////////////////////////// // // CAdditionalVertexStreamManager::MaybeSetAdditionalVertexStream // // Returns true if did set // /////////////////////////////////////////////////////////////// bool CAdditionalVertexStreamManager::MaybeSetAdditionalVertexStream ( D3DPRIMITIVETYPE PrimitiveType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount ) { // Cache info SCurrentStateInfo state; // Save call arguments state.args.PrimitiveType = PrimitiveType; state.args.BaseVertexIndex = BaseVertexIndex; state.args.MinVertexIndex = MinVertexIndex; state.args.NumVertices = NumVertices; state.args.startIndex = startIndex; state.args.primCount = primCount; // Cache info about state streams etc UpdateCurrentStateInfo ( state ); // For now, this only works if the original has 3 decl elements (0:D, 1:P, 1:T) and stream 1 has a stride of 20 if ( !CheckCanDoThis ( state ) ) return false; SetAdditionalVertexStream ( state ); return true; }
/////////////////////////////////////////////////////////////// // // CVertexStreamBoundingBoxManager::GetDistanceSqToGeometry // // // /////////////////////////////////////////////////////////////// float CVertexStreamBoundingBoxManager::GetDistanceSqToGeometry ( D3DPRIMITIVETYPE PrimitiveType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount ) { // Cache info SCurrentStateInfo2 state; // Save call arguments state.args.PrimitiveType = PrimitiveType; state.args.BaseVertexIndex = BaseVertexIndex; state.args.MinVertexIndex = MinVertexIndex; state.args.NumVertices = NumVertices; state.args.startIndex = startIndex; state.args.primCount = primCount; // Check can do this if ( !CheckCanDoThis ( state ) ) return 0.f; CBox boundingBox; if ( !GetVertexStreamBoundingBox ( state, boundingBox ) ) return 0.f; return CalcDistanceSq ( state, boundingBox ); }