Beispiel #1
0
void SWPolygonShape2D::set( const tarray<tvec2>& vertices )
{
	if ( vertices.size() <= 2 ) return;

	tuint count = vertices.size();
	m_normals.resize( count );
	m_vertices.resize( count );

	for ( tuint i = 0 ; i < vertices.size() ; ++i )
	{
		tuint i1 = i;
		tuint i2 = ((i+1)%count);
		
		const tvec2& v1 = vertices.at( i1 );
		const tvec2& v2 = vertices.at( i2 );
		tvec2 edge = v2 - v1;

		m_vertices[i] = v1;
		m_normals[i]  = edge.cross( 1 ).normal();
	}
	computeLocalOBB( m_localOBB );
}
inline void RayTesselatedTimeSampledTrianglePrimitive::_ResolveVertexAttrib(T& v0, T& v1, T& v2, int timeIdx, const tarray<T>& v) {
    v0 = v.at(triangles->triangles[idx][0], timeIdx);
    v1 = v.at(triangles->triangles[idx][1], timeIdx);
    v2 = v.at(triangles->triangles[idx][2], timeIdx);
}