Commit d24f3690 by Kai Westerkamp

Merge branch 'patchRender' of…

Merge branch 'patchRender' of ssh://git.breab.org:2223/kai/Unterteilungsalgorithmen into patchRender
parents 1de39cde 39d315af
...@@ -32,7 +32,7 @@ private: ...@@ -32,7 +32,7 @@ private:
QVector<GLuint> vertex_indices; QVector<GLuint> vertex_indices;
QVector<GLuint> vertex_offsets; QVector<GLuint> vertex_offsets;
QVector<GLuint> index_buffer; QVector<GLuint> index_buffer;
QVector<GLuint> index_regular; QVector<GLuint> patch_index_regular;
}; };
struct Result struct Result
...@@ -60,21 +60,41 @@ private: ...@@ -60,21 +60,41 @@ private:
void runVertexShader(GLuint size, GLuint vb_handle, GLuint vertex_indices_handle, GLuint vertex_offsets_handle, GLuint output_handle); void runVertexShader(GLuint size, GLuint vb_handle, GLuint vertex_indices_handle, GLuint vertex_offsets_handle, GLuint output_handle);
void runEdgeShader(GLuint size, GLuint vb_handle, GLuint edge_indices_handle, GLuint output_handle, GLuint offset); void runEdgeShader(GLuint size, GLuint vb_handle, GLuint edge_indices_handle, GLuint output_handle, GLuint offset);
//Geht davon aus, dass jeder 3D-Punkt nur einmal im Vertex-Buffer vorkommt!
QVector<unsigned int> getPatchIndexBuffer(QVector<unsigned int> ib);
QVector<unsigned int> getTriangles(QVector<unsigned int> ib); QVector<unsigned int> getTriangles(QVector<unsigned int> ib);
QVector<unsigned int> getPatchIndexBuffer(QVector<unsigned int> ib_regular, QVector<unsigned int> ib_irregular, QVector<Vertex> vb);
/**
* @brief matchAndCompleteTriangleIndices if Indices tx ty matches sxsy, sysz or szsy, fill tz with third source vertex index.
* @param sx source triangle: first vertex index
* @param sy source triangle: second vertex index
* @param sz source triangle: third vertex index
* @param tx target triangle: first known vertex index
* @param ty target triangle: second known vertex index
* @param tz target triangle: unknown vertex index.
* @return true if triangles could be matched and tz was filled.
* Only use this method if you are absolutely sure that each vertex position appears ONLY ONCE in the vertex buffer!!
* No duplicate vertices with different normals or crap like that!
*/
bool matchAndCompleteTriangleIndices(unsigned int sx, unsigned int sy, unsigned int sz, unsigned int tx, unsigned int ty, unsigned int& tz);
//same as matchandcomplete. doesn't rely on only one index per vertex location
//needs indices to fill tz
/** /**
* @brief matchAndCompleteTriangle if tx ty matches sxsy, sysz or szsy, fill tz with third source vertex index. * @brief matchAndCompleteTriangle if vertices at indices tx ty matches vertices at indices sxsy, sysz or szsy,
* @param sx source triangle: first vertex * fill tz with third source vertex index.
* @param sy source triangle: second vertex * @param sx source triangle: first vertex index
* @param sz source triangle: third vertex * @param sy source triangle: second vertex index
* @param tx target triangle: first known vertex * @param sz source triangle: third vertex index
* @param ty target triangle: second known vertex * @param tx target triangle: first known vertex index
* @param tz target triangle: unknown vertex. * @param ty target triangle: second known vertex index
* @param tz target triangle: unknown vertex index.
* @param vb Vertex Buffer. This method compares the actual positions of the vertices
* @return true if triangles could be matched and tz was filled. * @return true if triangles could be matched and tz was filled.
*/ */
bool matchAndCompleteTriangle(unsigned int sx, unsigned int sy, unsigned int sz, unsigned int tx, unsigned int ty, unsigned int& tz); bool matchAndCompleteTriangle(unsigned int sx, unsigned int sy, unsigned int sz, unsigned int tx, unsigned int ty, unsigned int &tz, QVector<Vertex> vb);
}; };
#endif #endif
...@@ -21,6 +21,12 @@ struct Vertex ...@@ -21,6 +21,12 @@ struct Vertex
Vertex(const QVector3D& pos, const QVector3D& normal, const QVector2D& tex); Vertex(const QVector3D& pos, const QVector3D& normal, const QVector2D& tex);
bool samePos(const Vertex& other) const; bool samePos(const Vertex& other) const;
bool operator==(const Vertex& other) const
{
return samePos(other);
}
}; };
#pragma pack(pop) #pragma pack(pop)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment