Inherits DD::Image::rPrimitive.
Public Types | |
enum | EdgeMask { eMaskEdge01, eMaskEdge12, eMaskEdge20, eMaskEdgeAll } |
Public Types inherited from DD::Image::rPrimitive | |
enum | rPrimitiveType { eUnknownRPrimitive, eRTriangle, eRPoint } |
Public Member Functions | |
const char * | Class () |
rTriangle (const GeoInfo *info, const Primitive *p) | |
rTriangle (const rTriangle &) | |
rPrimitive * | duplicate () const |
bool | add_to_render (Scene *, PrimitiveContext *) |
bool | add_to_displacement_render (Scene *, PrimitiveContext *) |
bool | intersect (float x, float y) const |
bool | intersect (float x, float y, float *dist) const |
bool | intersect_dist_squared (float x, float y, float *dist_squared) const |
bool | intersect_scanline (float y, int &X, int &R, VArray &out, VArray &du, VArray &dv) const |
float | trace (Scene *) |
float | distance (float x, float y) const |
float | distance_squared (float x, float y) const |
void | subdivide (std::vector< rPrimitive * > &primitives, SubdivisionContext *stx) |
rPrimitiveType | getPrimitiveType () const |
float | polygonEdgeDistance (const Vector4 &P, const float mindist) const |
Public Member Functions inherited from DD::Image::rPrimitive | |
rPrimitive (const GeoInfo *info, const Primitive *p) | |
rPrimitive (const rPrimitive &) | |
virtual | ~rPrimitive () |
const GeoInfo * | geoinfo () const |
const Primitive * | parent () const |
bool | cast_shadows () const |
bool | receive_shadows () const |
void * | operator new (size_t size) |
void | operator delete (void *mem) |
void * | operator new[] (size_t size) |
void | operator delete[] (void *mem) |
Public Member Functions inherited from DD::Image::Box3 | |
Box3 (float x, float y, float z) | |
Box3 (const Vector3 p) | |
Box3 (const Vector3 p1, const Vector3 p2) | |
const Vector3 & | min () const |
const Vector3 & | max () const |
float | x () const |
float | y () const |
float | n () const |
near, min z | |
float | r () const |
right, max x | |
float | t () const |
top, max y | |
float | f () const |
far, max z | |
float | w () const |
width | |
float | h () const |
height | |
float | d () const |
depth | |
Vector3 | center () const |
float | radius () const |
void | set (float x, float y, float z, float r, float t, float f) |
void | set (Vector3 p1, Vector3 p2) |
void | set (const Box3 &v) |
void | set_min (float x, float y, float z) |
void | set_max (float x, float y, float z) |
bool | empty () const |
void | clear () |
bool | inside (const Vector3 &p) const |
void | expand (const Box3 &v) |
void | expand (const Vector3 &p) |
void | intersect (const Box3 &v) |
void | transform (const Matrix4 &m) |
void | project (const Matrix4 &m, Box &bbox) const |
void | append (Hash &h) const |
void | print_info (const char *title=nullptr) const |
Public Attributes | |
VArray | v [3] |
in SCREEN coordiantes, w_normalized!!! | |
float | Ax |
float | Ay |
float | Bx |
float | By |
float | Nz |
For figuring out derivatives. | |
uint8_t | edgesmask |
triangle edge mask | |
rTriangle * | polygon |
cirular list of all triangles that define the original polygon | |
Additional Inherited Members | |
Protected Attributes inherited from DD::Image::rPrimitive | |
const GeoInfo * | geoinfo_ |
Parent object. | |
const Primitive * | parent_ |
What primitive generated us. | |
Renderable triangle class, created once a projection into screen space is known. The Triangle primitive class creates one of these, and add_to_render() may then change this to 0,1, or 2 renderable triangles (depending on clipping). Other primitives such as grid will create quite a few more of these.
rTriangle::rTriangle | ( | const rTriangle & | b | ) |
Copy constructor.
|
virtual |
Transform this triangle into homogeneous clipping space. Add any sub-triangles to the rendering scene. There's no need to further break a triangle down unless it intersects one of the frustum planes. Lastly we apply the homogeneous division by W which applies perspective to the points and places them into NDC space(Normalized Device Coordinates). This must be done AFTER clipping to guarantee that W is always > 0.
Clip the triangle against the frustum(W) near plane. There's two possibilities: a) One vertex is outside the plane. The triangle needs one additional edge defining the plane intersection line. To keep it a triangle we interpolate both vertices to the plane, and create one additional triangle primitive:
| 1 | 1 | /\ | /\ |/ \ 0 |/ \ | \ | A \ /| \ —> 1 |\ \ /X| \ | \ \ /XX| \ | \ \ /XXX| \ | B \ \ 0 -—|------— 2 0 |------— 2 | |
b) Two vertices are outside the plane, so the outside edge is simply interpolated to the plane: 1 | | /\ | | /XX\ | | /XXXX\| | /XXXXXX| ---> | /XXXXXXX|\ 1 |\ /XXXXXXXX| \ | \ /XXXXXXXXX| \ | \ 0 ----------|--- 2 0 |--- 2
| |
Implements DD::Image::rPrimitive.
References DD::Image::Scene::camera, edgesmask, DD::Image::eVelocityMotionVector, DD::Image::Scene::lens_func, DD::Image::CameraOp::projection_is_linear(), v, and DD::Image::Box3::w().
|
virtual |
Transform this triangle into homogeneous clipping space. And add to the displacement map list in scene
Reimplemented from DD::Image::rPrimitive.
References DD::Image::Iop::displacement_bound(), DD::Image::Scene::lens_func, and DD::Image::GeoInfo::material.
|
virtual |
Intersect the screen-space projected triangle with an XY point, returning true if successful.
Implements DD::Image::rPrimitive.
References v.
Referenced by distance().
|
virtual |
Intersect the screen-space projected triangle with an XY point. Return true it was successful, and assigns the distance to the nearest edge.
Implements DD::Image::rPrimitive.
References DD::Image::Box3::inside(), and intersect_dist_squared().
|
virtual |
Intersect the screen-space projected triangle with an XY point. Return true it was successful, and assigns the square of the distance to the nearest edge.
Implements DD::Image::rPrimitive.
References DD::Image::Box3::inside(), MIN(), and v.
Referenced by distance_squared(), and intersect().
|
virtual |
Intersect the triangle with a scanline. Return whether it was successful, and set X and R to the left and rightmost pixels affected, and set out to the value at 0,y (ie pixel 0 of the scanline, even if outside the triangle), and set du/dv to the screen-space derivatives, such that out+x*du is the value at any pixel in the scanline.
Implements DD::Image::rPrimitive.
References fast_floor(), Nz, and v.
|
virtual |
Not implemented yet.
Implements DD::Image::rPrimitive.
|
virtual |
Distance to the nearest edge the object in screen-space. Returns 0 or negative if inside the object.
Implements DD::Image::rPrimitive.
References DD::Image::Box3::d(), and intersect().
|
virtual |
Square of the distance to the nearest edge the object in screen-space. Returns 0 or negative if inside the object.
Implements DD::Image::rPrimitive.
References DD::Image::Box3::d(), and intersect_dist_squared().
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |