Blender  V2.93
BKE_subdiv_eval.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2018 by Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "BLI_sys_types.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct Mesh;
33 struct Subdiv;
34 
35 /* Returns true if evaluator is ready for use. */
36 bool BKE_subdiv_eval_begin(struct Subdiv *subdiv);
37 
38 /* coarse_vertex_cos is an optional argument which allows to override coordinates of the coarse
39  * mesh. */
41  const struct Mesh *mesh,
42  const float (*coarse_vertex_cos)[3]);
44  const struct Mesh *mesh,
45  const float (*coarse_vertex_cos)[3]);
46 
47 /* Makes sure displacement evaluator is initialized.
48  *
49  * NOTE: This function must be called once before evaluating displacement or
50  * final surface position. */
51 void BKE_subdiv_eval_init_displacement(struct Subdiv *subdiv);
52 
53 /* Single point queries. */
54 
55 /* Evaluate point at a limit surface, with optional derivatives and normal. */
56 
58  struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3]);
60  const int ptex_face_index,
61  const float u,
62  const float v,
63  float r_P[3],
64  float r_dPdu[3],
65  float r_dPdv[3]);
67  const int ptex_face_index,
68  const float u,
69  const float v,
70  float r_P[3],
71  float r_N[3]);
73  const int ptex_face_index,
74  const float u,
75  const float v,
76  float r_P[3],
77  short r_N[3]);
78 
79 /* Evaluate face-varying layer (such as UV). */
80 void BKE_subdiv_eval_face_varying(struct Subdiv *subdiv,
81  const int face_varying_channel,
82  const int ptex_face_index,
83  const float u,
84  const float v,
85  float r_face_varying[2]);
86 
87 /* NOTE: Expects derivatives to be correct.
88  *
89  * TODO(sergey): This is currently used together with
90  * BKE_subdiv_eval_final_point() which can easily evaluate derivatives.
91  * Would be nice to have displacement evaluation function which does not require
92  * knowing derivatives ahead of a time. */
93 void BKE_subdiv_eval_displacement(struct Subdiv *subdiv,
94  const int ptex_face_index,
95  const float u,
96  const float v,
97  const float dPdu[3],
98  const float dPdv[3],
99  float r_D[3]);
100 
101 /* Evaluate point on a limit surface with displacement applied to it. */
103  struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3]);
104 
105 /* Patch queries at given resolution.
106  *
107  * Will evaluate patch at uniformly distributed (u, v) coordinates on a grid
108  * of given resolution, producing resolution^2 evaluation points. The order
109  * goes as u in rows, v in columns. */
110 
112  const int ptex_face_index,
113  const int resolution,
114  void *buffer,
115  const int offset,
116  const int stride);
118  const int ptex_face_index,
119  const int resolution,
120  void *point_buffer,
121  const int point_offset,
122  const int point_stride,
123  void *du_buffer,
124  const int du_offset,
125  const int du_stride,
126  void *dv_buffer,
127  const int dv_offset,
128  const int dv_stride);
130  const int ptex_face_index,
131  const int resolution,
132  void *point_buffer,
133  const int point_offset,
134  const int point_stride,
135  void *normal_buffer,
136  const int normal_offset,
137  const int normal_stride);
139  const int ptex_face_index,
140  const int resolution,
141  void *point_buffer,
142  const int point_offset,
143  const int point_stride,
144  void *normal_buffer,
145  const int normal_offset,
146  const int normal_stride);
147 
148 #ifdef __cplusplus
149 }
150 #endif
void BKE_subdiv_eval_limit_point_and_short_normal(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3], short r_N[3])
Definition: subdiv_eval.c:224
void BKE_subdiv_eval_limit_point_and_normal(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3], float r_N[3])
Definition: subdiv_eval.c:211
void BKE_subdiv_eval_limit_patch_resolution_point(struct Subdiv *subdiv, const int ptex_face_index, const int resolution, void *buffer, const int offset, const int stride)
Definition: subdiv_eval.c:297
bool BKE_subdiv_eval_refine_from_mesh(struct Subdiv *subdiv, const struct Mesh *mesh, const float(*coarse_vertex_cos)[3])
void BKE_subdiv_eval_init_displacement(struct Subdiv *subdiv)
Definition: subdiv_eval.c:158
void BKE_subdiv_eval_limit_point(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3])
Definition: subdiv_eval.c:171
void BKE_subdiv_eval_limit_patch_resolution_point_and_short_normal(struct Subdiv *subdiv, const int ptex_face_index, const int resolution, void *point_buffer, const int point_offset, const int point_stride, void *normal_buffer, const int normal_offset, const int normal_stride)
Definition: subdiv_eval.c:372
void BKE_subdiv_eval_displacement(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, const float dPdu[3], const float dPdv[3], float r_D[3])
Definition: subdiv_eval.c:247
bool BKE_subdiv_eval_begin(struct Subdiv *subdiv)
Definition: subdiv_eval.c:41
bool BKE_subdiv_eval_begin_from_mesh(struct Subdiv *subdiv, const struct Mesh *mesh, const float(*coarse_vertex_cos)[3])
void BKE_subdiv_eval_limit_point_and_derivatives(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3], float r_dPdu[3], float r_dPdv[3])
Definition: subdiv_eval.c:177
void BKE_subdiv_eval_final_point(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3])
Definition: subdiv_eval.c:263
void BKE_subdiv_eval_limit_patch_resolution_point_and_derivatives(struct Subdiv *subdiv, const int ptex_face_index, const int resolution, void *point_buffer, const int point_offset, const int point_stride, void *du_buffer, const int du_offset, const int du_stride, void *dv_buffer, const int dv_offset, const int dv_stride)
Definition: subdiv_eval.c:316
void BKE_subdiv_eval_limit_patch_resolution_point_and_normal(struct Subdiv *subdiv, const int ptex_face_index, const int resolution, void *point_buffer, const int point_offset, const int point_stride, void *normal_buffer, const int normal_offset, const int normal_stride)
Definition: subdiv_eval.c:346
void BKE_subdiv_eval_face_varying(struct Subdiv *subdiv, const int face_varying_channel, const int ptex_face_index, const float u, const float v, float r_face_varying[2])
Definition: subdiv_eval.c:236
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei stride
ATTR_WARN_UNUSED_RESULT const BMVert * v
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer