コード例 #1
0
void updateValues( BorderSubdType i_BorderSubdType, const DeviceVector< T >& i_Src, const subd::TopologyData& i_Topo, int i_Stride, int i_Offset, DeviceVector< T >& o_Dst  )
{
	assert( o_Dst.size() != 0 );

	grind::subd::genFacePointsDevice( i_Topo.faceList.size(), i_Topo.faceList.getDevicePtr(), i_Src.getDevicePtr(), i_Topo.facePointsOffset, i_Topo.vertPointsOffset, i_Stride, i_Offset, o_Dst.getDevicePtr() );
	grind::subd::tweakVertPointsDevice( i_Topo.srcVertCount, i_Topo.vertFaceValence.getDevicePtr(), i_Topo.vertEdgeValence.getDevicePtr(), i_Topo.vertPointsOffset, i_Stride, i_Offset, o_Dst.getDevicePtr() );
	grind::subd::genEdgePointsDevice( i_Topo.edgeList.size(), i_Topo.edgeList.getDevicePtr(), i_Src.getDevicePtr(), i_Topo.vertFaceValence.getDevicePtr(), i_Topo.vertEdgeValence.getDevicePtr(), i_Topo.edgePointsOffset, i_Topo.vertPointsOffset, i_Stride, i_Offset, o_Dst.getDevicePtr() );
	grind::subd::genVertPointsDevice( i_BorderSubdType, i_Topo.srcVertCount, i_Src.getDevicePtr(), i_Topo.vertFaceValence.getDevicePtr(), i_Topo.vertEdgeValence.getDevicePtr(), i_Topo.vertPointsOffset, i_Stride, i_Offset, o_Dst.getDevicePtr() );
}
コード例 #2
0
//-------------------------------------------------------------------------------------------------
void updateTopology(	size_t i_SrcVertCount,
                    	const DeviceVector<int>& i_MeshConnectivity,
						const DeviceVector<int>& i_PolyVertCounts,
						subd::TopologyData& o_Topo,
						DeviceVector<int>* o_Id )
{
	o_Topo.srcVertCount = i_SrcVertCount;

	meshSanityCheck( i_PolyVertCounts );

	o_Topo.cumulativePolyVertCounts.resize( i_PolyVertCounts.size() );
	inclusiveScan( i_PolyVertCounts, o_Topo.cumulativePolyVertCounts );

	o_Topo.vertEdgeValence.resize( o_Topo.srcVertCount );
	setAllElements( 0, o_Topo.vertEdgeValence );
	o_Topo.vertFaceValence.resize( o_Topo.srcVertCount );
	setAllElements( 0, o_Topo.vertFaceValence );

	int face_count = i_PolyVertCounts.size();

	o_Topo.faceList.resize( face_count );

	buildFaceListDevice( face_count, i_MeshConnectivity.getDevicePtr(), o_Topo.cumulativePolyVertCounts.getDevicePtr(), o_Topo.faceList.getDevicePtr(), o_Topo.vertFaceValence.getDevicePtr() );

	int non_unique_edge_count = reduce( i_PolyVertCounts );

	DeviceVector< grind::subd::Edge > d_edges;
	d_edges.resize( non_unique_edge_count );
	int actual_edge_count = buildEdgeListDevice( face_count, i_MeshConnectivity.getDevicePtr(), o_Topo.cumulativePolyVertCounts.getDevicePtr(), d_edges.getDevicePtr(), o_Topo.vertEdgeValence.getDevicePtr() );
	o_Topo.edgeList.setValueDevice( d_edges.getDevicePtr(), actual_edge_count );

	int subd_quad_count = non_unique_edge_count;
	DRD_LOG_INFO( L, "faces before subd: " << face_count );
	DRD_LOG_INFO( L, "faces after subd: " << subd_quad_count );

	o_Topo.facePointsOffset = 0;
	o_Topo.edgePointsOffset = o_Topo.faceList.size();
	o_Topo.vertPointsOffset = o_Topo.faceList.size() + o_Topo.edgeList.size();

	if( o_Id != NULL ){
		o_Id->resize( subd_quad_count * 4, -1 );
		buildSubdFaceTopologyDevice( o_Topo.edgeList.size(), o_Topo.edgeList.getDevicePtr(), i_MeshConnectivity.getDevicePtr(), o_Topo.cumulativePolyVertCounts.getDevicePtr(), o_Topo.facePointsOffset, o_Topo.edgePointsOffset, o_Topo.vertPointsOffset, o_Id->getDevicePtr() );
	}
}