00001 #include "Quadric.h" 00002 #include "Rendergroup.h" 00003 #include "Program.h" 00004 #include "Stateset.h" 00005 #include "Sampler.h" 00006 00007 namespace RenderTools { 00008 00009 Quadric::Quadric( void ): 00010 Rendernode(){ 00011 00013 m_size[0] = 1.0; 00014 m_size[1] = 1.0; 00015 m_size[2] = 1.0; 00016 m_size[3] = 1.0; 00017 m_exponents[0] = 1.0; 00018 m_exponents[1] = 1.0; 00019 m_roundness[0] = 0.0; 00020 m_roundness[1] = 0.0; 00021 m_subdiv[0] = 6; 00022 m_subdiv[1] = 6; 00023 m_subdiv[2] = 6; 00024 00025 } 00026 00027 Quadric::~Quadric( void ){ 00028 00029 } 00030 00031 00033 double Quadric::sgnf( double x ) { 00034 if ( x < 0.0 ) 00035 return -1.0; 00036 if ( x > 0.0 ) 00037 return 1.0; 00038 return 0.0; 00039 } 00040 00045 double Quadric::cvn( double v, double n ) { 00046 double cv = cos( v ); 00047 return sgnf( cv ) * pow( fabs( cv ), n ); 00048 } 00049 00054 double Quadric::svn( double v, double n ) { 00055 double sv = sin( v ); 00056 return sgnf( sv ) * pow( fabs( sv ), n ); 00057 } 00058 00059 const Vec4 & Quadric::getSize( void ) const { 00060 return( m_size ); 00061 } 00062 00063 void Quadric::setSize( const Vec4 & v, bool send ){ 00064 m_size = v; 00066 } 00067 00068 const Vec2 & Quadric::getExponents( void ) const { 00069 return( m_exponents ); 00070 } 00071 00072 void Quadric::setExponents( const Vec2 & v, bool send ){ 00073 m_exponents = v; 00075 } 00076 00077 const Vec2 & Quadric::getRoundness( void ) const { 00078 return( m_roundness ); 00079 } 00080 00081 void Quadric::setRoundness( const Vec2 & v, bool send ){ 00082 m_roundness = v; 00084 } 00085 00086 const Vec3 & Quadric::getSubdivisions( void ) const { 00087 return( m_subdiv ); 00088 } 00089 00090 void Quadric::setSubdivisions( const Vec3 & v, bool send ){ 00091 m_subdiv = v; 00093 } 00094 00095 const bool Quadric::getCorrectUV( void ) const { 00096 return( m_correctUV ); 00097 } 00098 00099 void Quadric::setCorrectUV( bool state, bool send ){ 00100 m_correctUV = state; 00102 } 00103 00104 00105 00106 }; // namespace 00107
1.5.8