- Timestamp:
- 05/14/14 19:08:41 (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/common.hh
r204 r237 101 101 102 102 #if NV_COMPILER == NV_MSVC 103 #pragma warning(disable: 4201) 104 #undef _SCL_SECURE_NO_WARNINGS // to prevent redefinig 103 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union 104 #pragma warning( disable : 4510 ) // default constructor could not be generated 105 #pragma warning( disable : 4610 ) // object 'class' can never be instantiated - user-defined constructor required 106 #undef _SCL_SECURE_NO_WARNINGS // to prevent redefining 105 107 #define _SCL_SECURE_NO_WARNINGS 106 108 #endif … … 170 172 typedef uint64 uid; 171 173 174 struct empty_type {}; 175 172 176 } // namespace nv 173 177 -
trunk/nv/interface/device.hh
r236 r237 55 55 return result; 56 56 } 57 58 template < typename VTX, slot SLOT > 59 void add_vertex_buffer_impl( vertex_array*, vertex_buffer*, const std::false_type& ) 60 { 61 } 62 63 template < typename VTX, slot SLOT > 64 void add_vertex_buffer_impl( vertex_array* va, vertex_buffer* vb, const std::true_type& ) 65 { 66 typedef vertex_slot_info< VTX, SLOT > vinfo; 67 typedef datatype_traits< typename vinfo::value_type > dt_traits; 68 va->add_vertex_buffer( SLOT, vb, type_to_enum< dt_traits::base_type >::type, dt_traits::size, vinfo::offset, sizeof( VTX ), false ); 69 } 70 71 template < typename VTX, slot SLOT > 72 void add_vertex_buffer( vertex_array* va, vertex_buffer* vb ) 73 { 74 add_vertex_buffer_impl< VTX, SLOT >( va, vb, std::integral_constant< bool, vertex_has_slot< VTX, SLOT >::value >() ); 75 } 76 77 78 template < typename VTX > 79 vertex_array* create_vertex_array( const VTX* v, size_t count, buffer_hint hint ) 80 { 81 vertex_array* va = create_vertex_array(); 82 vertex_buffer* vb = create_vertex_buffer( hint, count * sizeof( VTX ), v ); 83 add_vertex_buffer< VTX, slot::POSITION > ( va, vb ); 84 add_vertex_buffer< VTX, slot::TEXCOORD > ( va, vb ); 85 add_vertex_buffer< VTX, slot::NORMAL > ( va, vb ); 86 add_vertex_buffer< VTX, slot::TANGENT > ( va, vb ); 87 add_vertex_buffer< VTX, slot::BONEINDEX > ( va, vb ); 88 add_vertex_buffer< VTX, slot::BONEWEIGHT >( va, vb ); 89 add_vertex_buffer< VTX, slot::COLOR > ( va, vb ); 90 return va; 91 } 92 93 template < typename VTX > 94 vertex_array* create_vertex_array( const std::vector< VTX >& data, buffer_hint hint ) 95 { 96 return create_vertex_array( data.data(), data.size(), hint ); 97 } 98 99 template < typename VTX, typename IDX > 100 vertex_array* create_vertex_array( const VTX* v, size_t vcount, const IDX* i, size_t icount, buffer_hint hint ) 101 { 102 vertex_array* va = create_vertex_array( v, vcount, hint ); 103 index_buffer* ib = create_index_buffer( hint, icount * sizeof( IDX ), i ); 104 va->set_index_buffer( ib, type_to_enum< IDX >::type, true ); 105 return va; 106 } 107 108 template < typename VTX, typename IDX > 109 vertex_array* create_vertex_array( const std::vector< VTX >& data, const std::vector< IDX >& idata, buffer_hint hint ) 110 { 111 return create_vertex_array( data.data(), data.size(), idata.data(), idata.size(), hint ); 112 } 113 57 114 virtual ~device() {} 58 115 }; -
trunk/nv/interface/program.hh
r235 r237 15 15 #include <unordered_map> 16 16 #include <nv/interface/uniform.hh> 17 #include <nv/interface/vertex.hh> 17 18 #include <nv/logging.hh> 18 19 #include <nv/exception.hh> … … 24 25 { 25 26 class camera; 26 27 enum slot28 {29 POSITION = 0,30 TEXCOORD = 1,31 NORMAL = 2,32 TANGENT = 3,33 BONEINDEX = 4,34 BONEWEIGHT = 5,35 COLOR = 6,36 };37 27 38 28 enum texture_slot -
trunk/nv/math.hh
r235 r237 83 83 enum datatype 84 84 { 85 NONE, 85 86 INT, 86 87 BYTE, … … 107 108 template < datatype EnumType > struct enum_to_type {}; 108 109 110 template <> struct enum_to_type< NONE > { typedef void type; }; 109 111 template <> struct enum_to_type< INT > { typedef int type; }; 110 112 template <> struct enum_to_type< UINT > { typedef unsigned int type; }; … … 160 162 template <> struct type_to_enum< mat4 > { static const datatype type = FLOAT_MATRIX_4; }; 161 163 164 template < typename T > 165 struct sizeof_type 166 { 167 static const int result = sizeof( T ); 168 }; 169 170 template <> 171 struct sizeof_type< void > 172 { 173 static const int result = 0; 174 }; 175 176 template < datatype T > 177 struct sizeof_enum_type 178 { 179 static const int result = sizeof_type< typename enum_to_type<T>::type >::result; 180 }; 181 162 182 163 183 } // namespace nv -
trunk/src/gfx/skeletal_mesh.cc
r231 r237 58 58 // Technically this is not needed, because the va is just a fake class, 59 59 // but if it's real it will be needed? 60 m_va->update_vertex_buffer( nv::slot::POSITION, m_vb_position, false ); 61 m_va->update_vertex_buffer( nv::slot::NORMAL, m_vb_normal, false ); 62 m_va->update_vertex_buffer( nv::slot::TANGENT, m_vb_tangent, false ); 60 // m_va->update_vertex_buffer( nv::slot::POSITION, m_vb_position, false ); 61 // m_va->update_vertex_buffer( nv::slot::NORMAL, m_vb_normal, false ); 62 // m_va->update_vertex_buffer( nv::slot::TANGENT, m_vb_tangent, false ); 63 // TODO: answer is - probably not 63 64 } 64 65 -
trunk/src/gl/gl_enum.cc
r233 r237 246 246 case GL_INT_VEC3 : return INT_VECTOR_3; 247 247 case GL_INT_VEC4 : return INT_VECTOR_4; 248 // TODO: separate types? 249 case GL_SAMPLER_1D : return INT; 250 case GL_SAMPLER_2D : return INT; 251 case GL_SAMPLER_3D : return INT; 252 case GL_SAMPLER_CUBE : return INT; 253 case GL_SAMPLER_1D_SHADOW : return INT; 254 case GL_SAMPLER_2D_SHADOW : return INT; 255 // TODO: implement? 256 // case GL_BOOL 257 // case GL_BOOL_VEC2 258 // case GL_BOOL_VEC3 259 // case GL_BOOL_VEC4 260 // case GL_FLOAT_MAT2x3 261 // case GL_FLOAT_MAT2x4 262 // case GL_FLOAT_MAT3x2 263 // case GL_FLOAT_MAT3x4 264 // case GL_FLOAT_MAT4x2 265 // case GL_FLOAT_MAT4x3 248 266 default : return datatype(0); // TODO: throw! 249 267 } -
trunk/src/gl/gl_program.cc
r235 r237 197 197 } 198 198 199 m_uniform_map[ name ] = create_uniform( utype, name, uni_loc, uni_len ); 199 uniform_base* u = create_uniform( utype, name, uni_loc, uni_len ); 200 NV_ASSERT( u, "Unknown uniform type!" ); 201 m_uniform_map[ name ] = u; 200 202 } 201 203 -
trunk/tests/objload_test/objload_test.cc
r224 r237 32 32 nv::vertex_array* m_va; 33 33 nv::program* m_program; 34 nv::mesh_data *m_mesh;34 nv::mesh_data_old* m_mesh; 35 35 nv::uint32 m_count; 36 36 }; … … 39 39 { 40 40 m_device = new nv::gl_device(); 41 m_window = m_device->create_window( 800, 600 );41 m_window = m_device->create_window( 800, 600, false ); 42 42 nv::sampler sampler( nv::sampler::LINEAR, nv::sampler::REPEAT ); 43 43
Note: See TracChangeset
for help on using the changeset viewer.