Panda3D
Public Member Functions | List of all members
QtessSurface Class Reference

A reference to an EggNurbsSurface in the egg file, and its parameters as set by the user input file and as computed in relation to the other surfaces. More...

#include "qtessSurface.h"

Inheritance diagram for QtessSurface:
ReferenceCount MemoryBase

Public Member Functions

 QtessSurface (EggNurbsSurface *egg_surface)
 
double count_patches () const
 Returns the number of patches the NURBS contains. More...
 
int count_tris () const
 Returns the number of triangles that will be generated by the current tesselation parameters. More...
 
const std::string & get_name () const
 
double get_score (double ratio)
 Computes the curvature/stretch score for the surface, if it has not been already computed, and returns the net surface score. More...
 
bool is_valid () const
 Returns true if the defined surface is valid, false otherwise. More...
 
void omit ()
 Sets up the surface to omit itself from the output. More...
 
void set_importance (double importance2)
 Sets the importance of the surface, as a ratio in proportion to the square of its size. More...
 
void set_match_u (QtessSurface **match_u, bool match_u_to_u)
 Indicates the surface to which this surface must match in its U direction. More...
 
void set_match_v (QtessSurface **match_v, bool match_v_to_v)
 Indicates the surface to which this surface must match in its V direction. More...
 
void set_min_u (int min_u)
 Specifies the absolute minimum number of segments allowed in the U direction. More...
 
void set_min_v (int min_v)
 Specifies the absolute minimum number of segments allowed in the V direction. More...
 
int tesselate ()
 Applies the appropriate tesselation to the surface, and replaces its node in the tree with an EggGroup containing both the new vertex pool and all of the polygons. More...
 
void tesselate_auto (int u, int v, double ratio)
 Sets the surface up to tesselate itself by automatically determining the best place to put the indicated u x v isoparams. More...
 
void tesselate_per_isoparam (double pi, bool autoplace, double ratio)
 Sets the surface up to tesselate itself to a uniform amount per isoparam. More...
 
void tesselate_per_score (double pi, bool autoplace, double ratio)
 Sets the surface up to tesselate itself according to its computed curvature score in both dimensions. More...
 
void tesselate_specific (const pvector< double > &u_list, const pvector< double > &v_list)
 Sets the surface up to tesselate itself at specific isoparams only. More...
 
void tesselate_uv (int u, int v, bool autoplace, double ratio)
 Sets the surface up to tesselate itself uniformly at u x v, or if autoplace is true, automatically with u x v quads. More...
 
int write_qtess_parameter (std::ostream &out)
 Writes a line to the given output file telling qtess how this surface should be tesselated uniformly. More...
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Detailed Description

A reference to an EggNurbsSurface in the egg file, and its parameters as set by the user input file and as computed in relation to the other surfaces.

Definition at line 32 of file qtessSurface.h.

Member Function Documentation

◆ count_patches()

double QtessSurface::count_patches ( ) const
inline

Returns the number of patches the NURBS contains.

Each patch is a square area bounded by isoparams. This actually scales by the importance of the surface, if it is not 1.

Definition at line 95 of file qtessSurface.I.

Referenced by QtessInputEntry::match().

◆ count_tris()

int QtessSurface::count_tris ( ) const
inline

Returns the number of triangles that will be generated by the current tesselation parameters.

Definition at line 104 of file qtessSurface.I.

Referenced by QtessInputEntry::count_tris(), and write_qtess_parameter().

◆ get_score()

double QtessSurface::get_score ( double  ratio)

Computes the curvature/stretch score for the surface, if it has not been already computed, and returns the net surface score.

This is used both for automatically distributing isoparams among the surfaces by curvature, as well as for automatically placing the isoparams within each surface by curvature.

Definition at line 91 of file qtessSurface.cxx.

Referenced by QtessInputEntry::match(), and tesselate_auto().

◆ is_valid()

bool QtessSurface::is_valid ( ) const
inline

Returns true if the defined surface is valid, false otherwise.

Definition at line 26 of file qtessSurface.I.

◆ omit()

void QtessSurface::omit ( )

Sets up the surface to omit itself from the output.

Definition at line 163 of file qtessSurface.cxx.

Referenced by QtessInputEntry::count_tris(), and tesselate_auto().

◆ set_importance()

void QtessSurface::set_importance ( double  importance2)
inline

Sets the importance of the surface, as a ratio in proportion to the square of its size.

Definition at line 35 of file qtessSurface.I.

Referenced by QtessInputEntry::match().

◆ set_match_u()

void QtessSurface::set_match_u ( QtessSurface **  match_u,
bool  match_u_to_u 
)
inline

Indicates the surface to which this surface must match in its U direction.

If u_to_u is true, it matches to the other surface's U direction; otherwise, it matches to the other surface's V direction.

Note that the surface pointer is an indirect pointer. The value passed in is the address of the pointer to the actual surface (which may or may not be filled in yet). The actual pointer may be filled in later.

Definition at line 50 of file qtessSurface.I.

Referenced by QtessInputEntry::match().

◆ set_match_v()

void QtessSurface::set_match_v ( QtessSurface **  match_v,
bool  match_v_to_v 
)
inline

Indicates the surface to which this surface must match in its V direction.

If v_to_v is true, it matches to the other surface's V direction; otherwise, it matches to the other surface's U direction.

Note that the surface pointer is an indirect pointer. The value passed in is the address of the pointer to the actual surface (which may or may not be filled in yet). The actual pointer may be filled in later.

Definition at line 65 of file qtessSurface.I.

Referenced by QtessInputEntry::match().

◆ set_min_u()

void QtessSurface::set_min_u ( int  min_u)
inline

Specifies the absolute minimum number of segments allowed in the U direction.

Definition at line 75 of file qtessSurface.I.

Referenced by QtessInputEntry::match().

◆ set_min_v()

void QtessSurface::set_min_v ( int  min_v)
inline

Specifies the absolute minimum number of segments allowed in the V direction.

Definition at line 84 of file qtessSurface.I.

Referenced by QtessInputEntry::match().

◆ tesselate()

int QtessSurface::tesselate ( )

Applies the appropriate tesselation to the surface, and replaces its node in the tree with an EggGroup containing both the new vertex pool and all of the polygons.

Definition at line 115 of file qtessSurface.cxx.

◆ tesselate_auto()

void QtessSurface::tesselate_auto ( int  u,
int  v,
double  ratio 
)

Sets the surface up to tesselate itself by automatically determining the best place to put the indicated u x v isoparams.

Definition at line 240 of file qtessSurface.cxx.

References get_score(), and omit().

Referenced by tesselate_uv().

◆ tesselate_per_isoparam()

void QtessSurface::tesselate_per_isoparam ( double  pi,
bool  autoplace,
double  ratio 
)

Sets the surface up to tesselate itself to a uniform amount per isoparam.

Definition at line 199 of file qtessSurface.cxx.

Referenced by QtessInputEntry::count_tris().

◆ tesselate_per_score()

void QtessSurface::tesselate_per_score ( double  pi,
bool  autoplace,
double  ratio 
)

Sets the surface up to tesselate itself according to its computed curvature score in both dimensions.

Definition at line 220 of file qtessSurface.cxx.

Referenced by QtessInputEntry::count_tris().

◆ tesselate_specific()

void QtessSurface::tesselate_specific ( const pvector< double > &  u_list,
const pvector< double > &  v_list 
)

Sets the surface up to tesselate itself at specific isoparams only.

Definition at line 187 of file qtessSurface.cxx.

Referenced by QtessInputEntry::count_tris().

◆ tesselate_uv()

void QtessSurface::tesselate_uv ( int  u,
int  v,
bool  autoplace,
double  ratio 
)

Sets the surface up to tesselate itself uniformly at u x v, or if autoplace is true, automatically with u x v quads.

Definition at line 173 of file qtessSurface.cxx.

References tesselate_auto().

Referenced by QtessInputEntry::count_tris().

◆ write_qtess_parameter()

int QtessSurface::write_qtess_parameter ( std::ostream &  out)

Writes a line to the given output file telling qtess how this surface should be tesselated uniformly.

Returns the number of tris.

Definition at line 139 of file qtessSurface.cxx.

References count_tris(), and QtessInputEntry::output_extra().


The documentation for this class was generated from the following files: