Пример #1
0
Mesh::Mesh(Point3 *vertices_, Vector3 *vertexNormals_,
           int nI_, int nJ_, bool wrapI_, bool wrapJ_)
    : nI(nI_), nJ(nJ_), wrapI(wrapI_), wrapJ(wrapJ_)
{
    nVertices = nI * nJ;
    vertices = new Point3[nVertices];
    vertexNormals = new Vector3[nVertices];
    for (int i = 0; i < nVertices; i++) {
        vertices[i] = vertices_[i];
        vertexNormals[i] = vertexNormals_[i];
    }

    // This enforces our requirement for distinct mesh points and thus
    // prevents later trouble.
    assert(pointsAreDistinct());

    createVertexIndices();
    createFaceNormals();

    allocateBuffers();
    //
    // Since we're handling transforms in the vertex shader, we only
    // need to download the buffers once, here in the constructor,
    // rather than in Mesh::render().
    //
    updateBuffers();
}
Пример #2
0
AutoTriangleMesh<PointType>::AutoTriangleMesh(const AutoTriangleMesh<PointType>::BaseMesh& source)
	:BaseMesh(source)
	{
	/* Polygon mesh is already created; now triangulate it: */
	triangulateAllFaces();
	
	/* Number all vertices: */
	createVertexIndices();
	}
Пример #3
0
AutoTriangleMesh<PointType>::AutoTriangleMesh(int numPoints,const InputPointType* points,const int* vertexIndices,int numSharpEdges,const int* sharpEdgeIndices)
	:BaseMesh(numPoints,points,vertexIndices,numSharpEdges,sharpEdgeIndices)
	{
	/* Polygon mesh is already created; now triangulate it: */
	triangulateAllFaces();
	
	/* Number all vertices: */
	createVertexIndices();
	}
Пример #4
0
AutoTriangleMesh<PointType>& AutoTriangleMesh<PointType>::operator=(const AutoTriangleMesh<PointType>::BaseMesh& source)
	{
	if(this!=&source)
		{
		/* Copy polygon mesh: */
		*this=source;
		
		/* Polygon mesh is already created; now triangulate it: */
		triangulateAllFaces();
		
		/* Number all vertices: */
		createVertexIndices();
		}
	
	return *this;
	}