Commit 7e92088b authored by Will Schroeder's avatar Will Schroeder
Browse files

Added two-sided lighting backface culling.

parent 9dc2ebea
......@@ -70,9 +70,9 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// Points arranged on a regular lattice (termed degenerate cases) can be
// triangulated in more than one way (at least according to the Delaunay
// criterion). The choice of triangulation (as implemented by
// this algorithm) depends on the order of the input points. The first three
// points will form a triangle; other degenerate points will not break
// this triangle.
// this algorithm) depends on the order of the input points. The first four
// points will form a tetrahedron; other degenerate points (relative to this
// initial tetrahedron) will not break it.
//
// Points that are coincident (or nearly so) may be discarded by the
// algorithm. This is because the Delaunay triangulation requires
......@@ -85,7 +85,15 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// multiplier used to control the size of the initial triangulation. The
// larger the offset value, the more likely you will generate a convex hull;
// and the more likely you are to see numerical problems.
//
// The implementation of this algorithm varies from the 2D Delaunay
// algorithm (i.e., vtkDelaunay2D) in an important way. When points are
// injected into the triangulation, the search for the enclosing tetrahedron
// is quite different. In the 3D case, the closest previously inserted point
// point is found, and then the connected tetrahedra are searched to find
// the containing one. (In 2D, a "walk" towards the enclosing triangle is
// performed.) If the triangulation is Delaunay, then an
// .SECTION See Also
// vtkDelaunay2D vtkGaussianSplatter vtkUnstructuredGrid
......
......@@ -45,7 +45,8 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// set are colors (overall, ambient, diffuse, specular, and edge color);
// specular power; opacity of the object; the representation of the
// object (points, wireframe, or surface); and the shading method to be
// used (flat, Gouraud, and Phong).
// used (flat, Gouraud, and Phong). Also, some special graphics features
// like backface properties can be set and manipulated with this object.
// .SECTION See Also
// vtkActor vtkPropertyDevice
......@@ -136,12 +137,6 @@ public:
vtkSetMacro(EdgeVisibility,int);
vtkBooleanMacro(EdgeVisibility,int);
// Description:
// Turn backface properties on and off (not implemented yet).
vtkGetMacro(Backface,int);
vtkSetMacro(Backface,int);
vtkBooleanMacro(Backface,int);
// Description:
// Set/Get the ambient surface color. Not all renderers support separate
// ambient and diffuse colors. From a physical standpoint it really
......@@ -165,6 +160,28 @@ public:
vtkSetVector3Macro(EdgeColor,float);
vtkGetVectorMacro(EdgeColor,float,3);
// Description:
// Turn backface properties on and off (not implemented yet).
vtkGetMacro(Backface,int);
vtkSetMacro(Backface,int);
vtkBooleanMacro(Backface,int);
// Description:
// Turn on/off fast culling of polygons based on orientation of normal
// with respect to camera. If backface culling is on, polygons facing
// away from camera are not drawn.
vtkGetMacro(BackfaceCulling,int);
vtkSetMacro(BackfaceCulling,int);
vtkBooleanMacro(BackfaceCulling,int);
// Description:
// Turn on/off fast culling of polygons based on orientation of normal
// with respect to camera. If frontface culling is on, polygons facing
// towards camera are not drawn.
vtkGetMacro(FrontfaceCulling,int);
vtkSetMacro(FrontfaceCulling,int);
vtkBooleanMacro(FrontfaceCulling,int);
protected:
float Color[3];
float AmbientColor[3];
......@@ -180,6 +197,8 @@ protected:
int Representation;
int EdgeVisibility;
int Backface;
int BackfaceCulling;
int FrontfaceCulling;
vtkPropertyDevice *Device;
};
......
......@@ -46,9 +46,10 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// a camera view into an image. vtkRenderer also performs coordinate
// transformation between world coordinates, view coordinates (the computer
// graphics rendering coordinate system), and display coordinates (the
// actual screen coordinates on the display device).
// actual screen coordinates on the display device). Certain advanced
// rendering features such as two-sided lighting can also be controlled.
// .SECTION see also
// .SECTION See Also
// vtkRenderWindow vtkActor vtkCamera vtkLight
#ifndef __vtkRenderer_hh
......@@ -170,6 +171,15 @@ public:
vtkSetVector4Macro(Viewport,float);
vtkGetVectorMacro(Viewport,float,4);
// Description:
// Turn on/off two-sided lighting of surfaces. If two-sided lighting is
// off, then only the side of the surface facing the light(s) will be lit,
// and the other side dark. If two-sided lighting on, both sides of the
// surface will be lit.
vtkGetMacro(TwoSidedLighting,int);
vtkSetMacro(TwoSidedLighting,int);
vtkBooleanMacro(TwoSidedLighting,int);
virtual float *GetCenter();
virtual void DisplayToView(); // these get modified in subclasses
......@@ -203,6 +213,7 @@ protected:
int SelfCreatedCamera;
int SelfCreatedLight;
float AllocatedRenderTime;
int TwoSidedLighting;
void (*StartRenderMethod)(void *);
void (*StartRenderMethodArgDelete)(void *);
......
......@@ -79,9 +79,12 @@ public:
void Derivatives(int subId, float pcoords[3], float *values,
int dim, float *derivs);
// triangle specific
// tetrahedron specific
void TetraCenter(float p1[3], float p2[3], float p3[3], float p4[3], float center[3]);
float Circumsphere(float p1[3], float p2[3], float p3[3], float p4[3], float center[3]);
int BarycentricCoords(float x[3], float x1[3], float x2[3], float x3[3],
float x4[3], float bcoords[4]);
};
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment