2022-02-11 13:53:21 +01:00
|
|
|
/* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
* Copyright 2011-2022 Blender Foundation */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
#ifndef __SUBD_PATCH_H__
|
|
|
|
|
#define __SUBD_PATCH_H__
|
|
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "util/boundbox.h"
|
|
|
|
|
#include "util/types.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
|
|
class Patch {
|
|
|
|
|
public:
|
2019-09-13 16:18:18 +02:00
|
|
|
Patch() : patch_index(0), shader(0), from_ngon(false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-14 01:53:09 -04:00
|
|
|
virtual ~Patch() = default;
|
|
|
|
|
|
2016-04-13 01:17:34 +02:00
|
|
|
virtual void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v) = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-07-16 19:42:28 -04:00
|
|
|
int patch_index;
|
|
|
|
|
int shader;
|
2019-08-14 01:53:09 -04:00
|
|
|
bool from_ngon;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Linear Quad Patch */
|
|
|
|
|
|
|
|
|
|
class LinearQuadPatch : public Patch {
|
|
|
|
|
public:
|
|
|
|
|
float3 hull[4];
|
2016-04-13 01:17:34 +02:00
|
|
|
float3 normals[4];
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2016-04-13 01:17:34 +02:00
|
|
|
void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v);
|
2011-04-27 11:58:34 +00:00
|
|
|
BoundBox bound();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Bicubic Patch */
|
|
|
|
|
|
|
|
|
|
class BicubicPatch : public Patch {
|
|
|
|
|
public:
|
|
|
|
|
float3 hull[16];
|
|
|
|
|
|
2016-04-13 01:17:34 +02:00
|
|
|
void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v);
|
2011-04-27 11:58:34 +00:00
|
|
|
BoundBox bound();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
|
|
#endif /* __SUBD_PATCH_H__ */
|