Nuke binary plugins 15.0.5
 
Loading...
Searching...
No Matches
DD::Image::Mesh Class Reference

#include <Mesh.h>

Inheritance diagram for DD::Image::Mesh:
DD::Image::PolygonPrimitive DD::Image::Primitive

Public Member Functions

const char * Class () const override
 
 Mesh (int columns, int rows, bool wrapU=false, bool wrapV=false, MeshSubdivisionMethod subd=QUADS)
 
 Mesh (const Mesh &)
 
Primitiveduplicate () const override
 
int columns () const
 
int rows () const
 
bool wrapU () const
 
bool wrapV () const
 
MeshSubdivisionMethod subd_method () const
 
void subd_method (MeshSubdivisionMethod v)
 
int vertex_index (int x, int y) const
 
unsigned point_index (int x, int y) const
 
int add_points (PointList *, int plane=PLANE_ZX)
 
void remap_points (PointList *, int plane=PLANE_ZX, float sx=1.0f, float sy=1.0f) const
 
void create_point_uvs (Attribute *, float scaleU=1.0f, float scaleV=1.0f) const
 
void create_point_uvs (Attribute *attrib, float minU, float minV, float maxU, float maxV) const
 
void create_point_normals (Attribute *, const Vector3 &N) const
 
bool IntersectsRay (const Ray &ray, int n, const PointList *pointList, CollisionResult *result) const override
 Test for the intersection of this primitive with a given ray.
 
void validate (PrimitiveContext *) override
 
Vector3 vertex_normal (unsigned v, const PointList *) const override
 
Vector3 get_face_normal (int n, const PointList *points) const override
 
void tessellateFace (int faceIndex, Scene *scene, PrimitiveContext *ptx, VertexContext *vtx) const override
 
void tessellate (Scene *scene, PrimitiveContext *ptx) const override
 
unsigned faces () const override
 
Vector3 face_average_center (int n, const PointList *) const override
 
unsigned face_vertices (int n) const override
 
void get_face_vertices (int n, unsigned *array) const override
 
void draw_wireframe (ViewerContext *, PrimitiveContext *, Primitive *prev_prim=nullptr) const override
 
void draw_solid (ViewerContext *, PrimitiveContext *, Primitive *prev_prim=nullptr) const override
 
void draw_solid_face (int n, ViewerContext *, PrimitiveContext *) const override
 
void draw_primitive_normal (ViewerContext *, PrimitiveContext *) const override
 Draw poly's normal.
 
void print_info () const override
 
PrimitiveType getPrimitiveType () const override
 
- Public Member Functions inherited from DD::Image::PolygonPrimitive
 PolygonPrimitive (unsigned vertices=0)
 
void tessellate (Scene *, PrimitiveContext *) const override
 
virtual void tessellateFace (int faceIndex, Scene *scene, PrimitiveContext *ptx, VertexContext *vtx) const
 
- Public Member Functions inherited from DD::Image::Primitive
virtual void vertex_shader (int v, Scene *, PrimitiveContext *, VArray &out, const Vector3 *normal=nullptr) const
 
virtual void vertex_shader (int v, Scene *, PrimitiveContext *, VertexContext &, VArray &out, const Vector3 *normal=nullptr) const
 
 Primitive (unsigned vertices=0)
 
 Primitive (const Primitive &)
 
virtual ~Primitive ()
 
virtual const char * Class () const =0
 
virtual Primitiveduplicate () const =0
 
void getDataArray (int n, ViewerContext *ctx, PrimitiveContext *ptx, std::vector< Vector3 > &pntArray, std::vector< Vector3 > &normalArray, std::vector< Vector4 > &uvOrColArray, bool &validUV) const
 
const unsigned & vertex (unsigned v) const
 
unsigned & vertex (unsigned v)
 
unsigned vertices () const
 
void offset_point_indices (int offset)
 
unsigned vertex_offset () const
 
void build_index_array (unsigned *indices, unsigned primitive, unsigned vertex) const
 
unsigned add_vertex (unsigned point_index)
 
unsigned add_vertices (unsigned num)
 
virtual Vector3 average_center (const PointList *) const
 Returns the xyz center average of the primitive.
 
virtual Vector3 average_center_and_bounds (int f, const PointList *points, Vector3 &min, Vector3 &max) const
 
virtual unsigned faces () const =0
 
virtual Vector3 face_average_center (int n, const PointList *points) const
 
virtual unsigned face_vertices (int n) const
 
virtual void get_face_vertices (int n, unsigned *array) const
 
virtual Box3 get_bbox (const GeoInfo *info) const
 
virtual Vector3 get_face_normal (int n, const PointList *points) const
 
virtual Vector3 get_geometric_normal (int v, const PointList *points) const
 
virtual int get_vertex_faces (int v, std::vector< int > &faces) const
 
virtual bool IntersectsRay (const Ray &ray, int n, const PointList *pointList, CollisionResult *result) const
 
virtual void validate (PrimitiveContext *)
 
virtual bool faceUsesVertex (unsigned int faceIdx, unsigned int vertIdx) const
 
Iopmaterial () const
 
IoprenderingShader (const GeoInfo *info) const
 
const Vector3normal () const
 
virtual Vector3 vertex_normal (unsigned v, const PointList *) const
 
virtual void tessellate (Scene *, PrimitiveContext *) const =0
 
virtual void draw_wireframe (ViewerContext *, PrimitiveContext *, Primitive *prev_prim=nullptr) const =0
 
virtual void draw_solid (ViewerContext *, PrimitiveContext *, Primitive *prev_prim=nullptr) const =0
 
virtual void draw_solid_face (int n, ViewerContext *, PrimitiveContext *) const
 
virtual void draw_primitive_normal (ViewerContext *, PrimitiveContext *) const
 
virtual void draw_primitive_num (ViewerContext *, PrimitiveContext *) const
 
virtual void draw_vertex_num (ViewerContext *, PrimitiveContext *) const
 
virtual void draw_vertex_normals (ViewerContext *, PrimitiveContext *) const
 
virtual void draw_vertex_uvs (ViewerContext *, PrimitiveContext *) const
 
virtual void print_info () const
 
virtual PrimitiveType getPrimitiveType () const
 
void * operator new (size_t size)
 
void operator delete (void *mem)
 
void * operator new[] (size_t size)
 
void operator delete[] (void *mem)
 

Static Public Member Functions

static int mesh_index (int x, int y, int w)
 
- Static Public Member Functions inherited from DD::Image::Primitive
static void draw_normal (const Vector3 &p, const Vector3 &n, ViewerContext *, PrimitiveContext *)
 

Protected Member Functions

void copy (const Mesh *)
 
- Protected Member Functions inherited from DD::Image::Primitive
void draw_wireframe_vertex (int v, ViewerContext *, PrimitiveContext *) const
 
void draw_solid_vertex (int v, ViewerContext *, PrimitiveContext *) const
 
void copy (const Primitive *)
 
bool PolyIntersectsRay (const Ray &ray, int n, const PointList *pointList, CollisionResult *result) const
 

Protected Attributes

int columns_
 
int rows_
 Number of rows and columns.
 
bool wrapU_
 
bool wrapV_
 Whether mesh wraps around - only one can be true.
 
MeshSubdivisionMethod subd_method_
 What method to subdivide the mesh.
 
- Protected Attributes inherited from DD::Image::Primitive
std::vector< unsigned, STL3DAllocator< unsigned > > vertex_
 Point indices.
 
unsigned vertex_offset_
 Vertex attribute starting index.
 
Vector3 normal_
 Normal determined from vertex positions.
 
Iopmaterial_
 Material assignment.
 

Detailed Description

A 2-dimensional mesh of m*n vertices.

Member Function Documentation

◆ copy()

void Mesh::copy ( const Mesh b)
protected

Destructive copy.

References DD::Image::Primitive::copy(), rows_, subd_method_, and wrapV_.

◆ Class()

const char * Mesh::Class ( ) const
overridevirtual

Implements DD::Image::Primitive.

◆ duplicate()

Primitive * Mesh::duplicate ( ) const
overridevirtual

Copy this Mesh into a new one, and return a pointer to it. Vertex data is duplicated, point indices are unchanged.

Implements DD::Image::Primitive.

◆ add_points()

int Mesh::add_points ( PointList points,
int  plane = PLANE_ZX 
)

Add the points for the mesh to the GeoInfo's PointList. This is a convenience function.

References rows_, and DD::Image::Primitive::vertex_.

◆ create_point_uvs() [1/2]

void Mesh::create_point_uvs ( Attribute attrib,
float  scaleU = 1.0f,
float  scaleV = 1.0f 
) const

Add uvs to the points. U/V will map 0->1. This is a convenience function.

References DD::Image::Attribute::resize(), rows_, DD::Image::Vector4::set(), and DD::Image::VECTOR4_ATTRIB.

◆ create_point_uvs() [2/2]

void Mesh::create_point_uvs ( Attribute attrib,
float  minU,
float  minV,
float  maxU,
float  maxV 
) const

Add uvs to the points. U/V will map (minU, minV) -> (maxU, maxV). This is a convenience function.

References DD::Image::Attribute::resize(), rows_, DD::Image::Vector4::set(), and DD::Image::VECTOR4_ATTRIB.

◆ create_point_normals()

void Mesh::create_point_normals ( Attribute attrib,
const Vector3 N 
) const

Add normal N to each point. This is a convenience function.

References DD::Image::NORMAL_ATTRIB, DD::Image::Attribute::resize(), and rows_.

◆ IntersectsRay()

bool DD::Image::Mesh::IntersectsRay ( const Ray ray,
int  n,
const PointList pointList,
CollisionResult *  result 
) const
inlineoverridevirtual

Test for the intersection of this primitive with a given ray.

If a collision is detected, information is returned in the collision result

Reimplemented from DD::Image::Primitive.

◆ validate()

void Mesh::validate ( PrimitiveContext ptx)
overridevirtual

If Normal attribute doesn't exist, create it from the constituent faces.

Reimplemented from DD::Image::Primitive.

References DD::Image::Vector3::fast_normalize(), DD::Image::Primitive::normal_, rows_, DD::Image::Vector3::set(), subd_method_, and DD::Image::Primitive::validate().

◆ vertex_normal()

Vector3 Mesh::vertex_normal ( unsigned  v,
const PointList points 
) const
overridevirtual

Return a normal that best represents the normal at point's location on the mesh surface.

Reimplemented from DD::Image::Primitive.

References DD::Image::Vector3::normalize(), rows_, and subd_method_.

◆ get_face_normal()

Vector3 Mesh::get_face_normal ( int  n,
const PointList points 
) const
overridevirtual

Returns the normal for face.

Reimplemented from DD::Image::Primitive.

References get_face_vertices(), and DD::Image::Vector3::normalize().

◆ tessellateFace()

void Mesh::tessellateFace ( int  faceIndex,
Scene scene,
PrimitiveContext ptx,
VertexContext vtx 
) const
overridevirtual

◆ tessellate()

void Mesh::tessellate ( Scene scene,
PrimitiveContext ptx 
) const
overridevirtual

Implements DD::Image::Primitive.

◆ faces()

unsigned DD::Image::Mesh::faces ( ) const
inlineoverridevirtual

Implements DD::Image::Primitive.

◆ face_average_center()

Vector3 Mesh::face_average_center ( int  n,
const PointList points 
) const
overridevirtual

Return the subface's average local-space center.

Reimplemented from DD::Image::Primitive.

References get_face_vertices().

◆ face_vertices()

unsigned DD::Image::Mesh::face_vertices ( int  n) const
inlineoverridevirtual

Reimplemented from DD::Image::Primitive.

◆ get_face_vertices()

void Mesh::get_face_vertices ( int  n,
unsigned *  array 
) const
overridevirtual

Fill the pre-allocated array with vertices constituting the sub face.

Reimplemented from DD::Image::Primitive.

Referenced by face_average_center(), get_face_normal(), and tessellateFace().

◆ draw_wireframe()

void Mesh::draw_wireframe ( ViewerContext ctx,
PrimitiveContext ptx,
Primitive prev_prim = nullptr 
) const
overridevirtual

Implements DD::Image::Primitive.

◆ draw_solid()

void Mesh::draw_solid ( ViewerContext ctx,
PrimitiveContext ptx,
Primitive prev_prim = nullptr 
) const
overridevirtual

Implements DD::Image::Primitive.

◆ draw_solid_face()

void Mesh::draw_solid_face ( int  n,
ViewerContext ctx,
PrimitiveContext ptx 
) const
overridevirtual

Draw the specified face as a filled quad.

Reimplemented from DD::Image::Primitive.

◆ draw_primitive_normal()

void Mesh::draw_primitive_normal ( ViewerContext ctx,
PrimitiveContext ptx 
) const
overridevirtual

Draw poly's normal.

Reimplemented from DD::Image::Primitive.

References DD::Image::Primitive::draw_primitive_normal().

◆ print_info()

void Mesh::print_info ( ) const
overridevirtual

Reimplemented from DD::Image::Primitive.

◆ getPrimitiveType()

PrimitiveType DD::Image::Mesh::getPrimitiveType ( ) const
inlineoverridevirtual

Reimplemented from DD::Image::Primitive.



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com