Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-07-11 11:36:13 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-07-11 13:55:22 +0300
commitc37ca437209f00ffe1b56cef2a5e8bbf390e669a (patch)
tree75f09f48e0c07cc18d5f87573344fcc65c80b9a8 /intern/opensubdiv/opensubdiv_capi.h
parent3eab8156d369f40de9d8c23672b1de28491ea920 (diff)
OpenSubdiv: Changes in C-API
- Made OpenSubdiv_GLMesh private Previously, it was still accessible via C-API from C++ code. - Don't implicitly refine evaluator when updating coarse positions, now there is an explicit call to do this. Allows to first apply all changes to the coarse mesh and then refine once. - Added coarse positions update from a continuous buffer with given starts offset and stride. Allows to update coarse positions directly from MVert array. - Refiner is no longer freed when CPU evaluator is created. Allows to re-use refiner for multiple purposes.
Diffstat (limited to 'intern/opensubdiv/opensubdiv_capi.h')
-rw-r--r--intern/opensubdiv/opensubdiv_capi.h72
1 files changed, 38 insertions, 34 deletions
diff --git a/intern/opensubdiv/opensubdiv_capi.h b/intern/opensubdiv/opensubdiv_capi.h
index 2c3fcee7dbb..c29d08a77e1 100644
--- a/intern/opensubdiv/opensubdiv_capi.h
+++ b/intern/opensubdiv/opensubdiv_capi.h
@@ -32,22 +32,12 @@ extern "C" {
// Types declaration.
struct OpenSubdiv_GLMesh;
+struct OpenSubdiv_GLMeshDescr;
struct OpenSubdiv_GLMeshFVarData;
struct OpenSubdiv_TopologyRefinerDescr;
typedef struct OpenSubdiv_GLMesh OpenSubdiv_GLMesh;
-#ifdef __cplusplus
-struct OpenSubdiv_GLMeshDescr;
-
-typedef struct OpenSubdiv_GLMesh {
- int evaluator_type;
- OpenSubdiv_GLMeshDescr *descriptor;
- OpenSubdiv_TopologyRefinerDescr *topology_refiner;
- OpenSubdiv_GLMeshFVarData *fvar_data;
-} OpenSubdiv_GLMesh;
-#endif
-
// Keep this a bitmask os it's possible to pass available
// evaluators to Blender.
enum {
@@ -86,11 +76,7 @@ void openSubdiv_osdGLMeshBindVertexBuffer(OpenSubdiv_GLMesh *gl_mesh);
const struct OpenSubdiv_TopologyRefinerDescr *openSubdiv_getGLMeshTopologyRefiner(
OpenSubdiv_GLMesh *gl_mesh);
-/* ** Initialize/Deinitialize global OpenGL drawing buffers/GLSL programs ** */
-bool openSubdiv_osdGLDisplayInit(void);
-void openSubdiv_osdGLDisplayDeinit(void);
-
-/* ** Evaluator API ** */
+/* ============================= Evaluator API ============================== */
struct OpenSubdiv_EvaluatorDescr;
typedef struct OpenSubdiv_EvaluatorDescr OpenSubdiv_EvaluatorDescr;
@@ -100,17 +86,29 @@ OpenSubdiv_EvaluatorDescr *openSubdiv_createEvaluatorDescr(
struct OpenSubdiv_TopologyRefinerDescr *topology_refiner,
int subsurf_level);
-void openSubdiv_deleteEvaluatorDescr(OpenSubdiv_EvaluatorDescr *evaluator_descr);
-
-void openSubdiv_setEvaluatorCoarsePositions(OpenSubdiv_EvaluatorDescr *evaluator_descr,
- float *positions,
- int start_vert,
- int num_vert);
-
-void openSubdiv_setEvaluatorVaryingData(OpenSubdiv_EvaluatorDescr *evaluator_descr,
- float *varying_data,
- int start_vert,
- int num_vert);
+void openSubdiv_deleteEvaluatorDescr(
+ OpenSubdiv_EvaluatorDescr *evaluator_descr);
+
+void openSubdiv_setEvaluatorCoarsePositions(
+ OpenSubdiv_EvaluatorDescr *evaluator_descr,
+ const float *positions,
+ int start_vertex_index,
+ int num_vertices);
+void openSubdiv_setEvaluatorVaryingData(
+ OpenSubdiv_EvaluatorDescr *evaluator_descr,
+ const float *varying_data,
+ int start_vertex_index,
+ int num_vertices);
+
+void openSubdiv_setEvaluatorCoarsePositionsFromBuffer(
+ OpenSubdiv_EvaluatorDescr *evaluator_descr,
+ const void *buffer,
+ int start_offset,
+ int stride,
+ int start_vertex_index,
+ int num_vertices);
+
+void openSubdiv_refineEvaluator(OpenSubdiv_EvaluatorDescr *evaluator_descr);
void openSubdiv_evaluateLimit(OpenSubdiv_EvaluatorDescr *evaluator_descr,
int osd_face_index,
@@ -124,15 +122,18 @@ void openSubdiv_evaluateVarying(OpenSubdiv_EvaluatorDescr *evaluator_descr,
float face_u, float face_v,
float varying[3]);
-/* ** Actual drawing ** */
+/* ============================== Mesh drawing =============================== */
+
+/* Initialize/Deinitialize global OpenGL drawing buffers/GLSL programs. */
+bool openSubdiv_osdGLDisplayInit(void);
+void openSubdiv_osdGLDisplayDeinit(void);
/* Initialize all the invariants which stays the same for every single path,
* for example lighting model stays untouched for the whole mesh.
*
* TODO(sergey): Some of the stuff could be initialized once for all meshes.
*/
-void openSubdiv_osdGLMeshDisplayPrepare(int use_osd_glsl,
- int active_uv_index);
+void openSubdiv_osdGLMeshDisplayPrepare(int use_osd_glsl, int active_uv_index);
/* Draw specified patches. */
void openSubdiv_osdGLMeshDisplay(OpenSubdiv_GLMesh *gl_mesh,
@@ -140,12 +141,15 @@ void openSubdiv_osdGLMeshDisplay(OpenSubdiv_GLMesh *gl_mesh,
int start_patch,
int num_patches);
-void openSubdiv_osdGLAllocFVar(struct OpenSubdiv_TopologyRefinerDescr *topology_refiner,
- OpenSubdiv_GLMesh *gl_mesh,
- const float *fvar_data);
+void openSubdiv_osdGLAllocFVar(
+ struct OpenSubdiv_TopologyRefinerDescr *topology_refiner,
+ OpenSubdiv_GLMesh *gl_mesh,
+ const float *fvar_data);
+
void openSubdiv_osdGLDestroyFVar(OpenSubdiv_GLMesh *gl_mesh);
-/* ** Utility functions ** */
+/* =========================== Utility functions ============================ */
+
int openSubdiv_getAvailableEvaluators(void);
void openSubdiv_init(void);
void openSubdiv_cleanup(void);