Changeset 461
- Timestamp:
- 08/19/15 19:01:16 (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/interface/device.hh
r439 r461 56 56 TEX_SPECULAR = 1, 57 57 TEX_NORMAL = 2, 58 TEX_GLOSS = 3, 58 59 TEXTURE_0 = 0, 59 60 TEXTURE_1 = 1, … … 295 296 factory_link_map[ "nv_t_specular"] = new engine_link_uniform_int<1>(); 296 297 factory_link_map[ "nv_t_normal" ] = new engine_link_uniform_int<2>(); 298 factory_link_map[ "nv_t_gloss" ] = new engine_link_uniform_int<3>(); 297 299 } 298 300 void destroy_engine_uniforms() -
trunk/nv/interface/image_data.hh
r440 r461 30 30 BGR, 31 31 BGRA, 32 RED, 32 33 }; 33 34 … … 50 51 const ivec2 get_size() const { return m_size; } 51 52 // TODO : better depth check (template?) 52 size_t get_depth() const { return m_format.format == RGB || m_format.format == BGR ? 3 : 4; }53 size_t get_depth() const { return m_format.format == RGB || m_format.format == BGR ? 3 : ( m_format.format == RED ? 1 : 4 ); } 53 54 image_format get_format() const { return m_format; } 54 55 ~image_data() { if (m_data) delete[] m_data; } -
trunk/nv/stl/math/quaternion.hh
r459 r461 48 48 49 49 constexpr tquat() 50 : x( 0 ), y( 0 ), z( 0 ), w( 0) {};50 : x( 0 ), y( 0 ), z( 0 ), w( 1 ) {}; 51 51 constexpr tquat( const tquat<T>& q ) 52 52 : x( q.x ), y( q.y ), z( q.z ), w( q.w ) {} … … 83 83 inline tquat<T>& operator*=( const tquat<T>& q ) 84 84 { 85 this->w = w * q.w - x * q.x - y * q.y - z * q.z; 86 this->x = w * q.x + x * q.w + y * q.z - z * q.y; 87 this->y = w * q.y + y * q.w + z * q.x - x * q.z; 88 this->z = w * q.z + z * q.w + x * q.y - y * q.x; 85 tquat<T> p( *this ); 86 87 this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z; 88 this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y; 89 this->y = p.w * q.y + p.y * q.w + p.z * q.x - p.x * q.z; 90 this->z = p.w * q.z + p.z * q.w + p.x * q.y - p.y * q.x; 89 91 return *this; 90 92 } … … 159 161 inline tquat<T> normalize( const tquat<T>& q ) 160 162 { 161 T len = length( q );163 T len = math::length( q ); 162 164 if ( len <= T( 0 ) ) return tquat<T>( 1, 0, 0, 0 ); 163 165 T rlen = T( 1 ) / len; … … 392 394 tquat<T> result( ctor::uninitialize ); 393 395 T sina = sin( angle * static_cast<T>( 0.5 ) ); 394 result.w = ( angle * static_cast<T>( 0.5 ) );396 result.w = cos( angle * static_cast<T>( 0.5 ) ); 395 397 result.x = v.x * sina; 396 398 result.y = v.y * sina; -
trunk/src/gl/gl_device.cc
r439 r461 51 51 } 52 52 // TODO: BGR vs RGB, single channel 53 assert( image->format->BytesPerPixel > 2 ); 54 image_format format(image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE ); 53 pixel_format pformat = RGBA; 54 switch ( image->format->BytesPerPixel ) 55 { 56 case 4: pformat = RGBA; break; 57 case 3: pformat = RGB; break; 58 case 1: pformat = RED; break; 59 default: NV_ASSERT( false, "BytesPerPixel != 4,3 or 1!" ); 60 } 61 image_format format( pformat, UBYTE ); 55 62 image_data* data = new image_data( format, ivec2( image->w, image->h ), static_cast<nv::uint8*>( image->pixels ) ); 56 63 return data; -
trunk/src/gl/gl_enum.cc
r438 r461 184 184 case BGR : return GL_BGR; 185 185 case BGRA : return GL_BGRA; 186 case RED : return GL_RED; 186 187 NV_RETURN_COVERED_DEFAULT( 0 ); 187 188 } … … 200 201 case BGR : return GL_RGB8; 201 202 case BGRA : return GL_RGBA8; 203 case RED : return 0x8040; // GL_LUMINANCE8; // TODO: change to GL_R8! 204 202 205 NV_RETURN_COVERED_DEFAULT( 0 ); 203 206 }
Note: See TracChangeset
for help on using the changeset viewer.