Blender  V2.93
subd_patch.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __SUBD_PATCH_H__
18 #define __SUBD_PATCH_H__
19 
20 #include "util/util_boundbox.h"
21 #include "util/util_types.h"
22 
24 
25 class Patch {
26  public:
27  Patch() : patch_index(0), shader(0), from_ngon(false)
28  {
29  }
30 
31  virtual ~Patch() = default;
32 
33  virtual void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v) = 0;
34 
36  int shader;
37  bool from_ngon;
38 };
39 
40 /* Linear Quad Patch */
41 
42 class LinearQuadPatch : public Patch {
43  public:
46 
47  void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v);
48  BoundBox bound();
49 };
50 
51 /* Bicubic Patch */
52 
53 class BicubicPatch : public Patch {
54  public:
55  float3 hull[16];
56 
57  void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v);
58  BoundBox bound();
59 };
60 
62 
63 #endif /* __SUBD_PATCH_H__ */
ATTR_WARN_UNUSED_RESULT const BMVert * v
BoundBox bound()
Definition: subd_patch.cpp:111
float3 hull[16]
Definition: subd_patch.h:55
void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v)
Definition: subd_patch.cpp:93
float3 hull[4]
Definition: subd_patch.h:44
BoundBox bound()
Definition: subd_patch.cpp:81
float3 normals[4]
Definition: subd_patch.h:45
void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v)
Definition: subd_patch.cpp:63
int shader
Definition: subd_patch.h:36
bool from_ngon
Definition: subd_patch.h:37
int patch_index
Definition: subd_patch.h:35
Patch()
Definition: subd_patch.h:27
virtual void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v)=0
virtual ~Patch()=default
#define CCL_NAMESPACE_END
static float P(float k)
Definition: math_interp.c:41
params N