Changeset 62
- Timestamp:
- 05/30/13 16:44:38 (12 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/gl/gl_device.hh
r49 r62 26 26 virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr ); 27 27 virtual vertex_array* create_vertex_array(); 28 virtual texture2d* create_texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler, void* data = nullptr );28 virtual texture2d* create_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data = nullptr ); 29 29 virtual ~gl_device(); 30 30 private: -
trunk/nv/gl/gl_enum.hh
r49 r62 37 37 unsigned int primitive_to_enum( primitive p ); 38 38 39 unsigned int type_to_gl_enum( type type );40 type gl_enum_to_type( unsigned int gl_enum );39 unsigned int type_to_gl_enum( etype type ); 40 etype gl_enum_to_type( unsigned int gl_enum ); 41 41 42 42 } // namespace nv -
trunk/nv/gl/gl_texture2d.hh
r49 r62 22 22 { 23 23 public: 24 gl_texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler, void* data = nullptr );24 gl_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data = nullptr ); 25 25 virtual void assign( void* data ); 26 26 virtual void bind( int slot = 0 ); -
trunk/nv/interface/device.hh
r49 r62 31 31 virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr ) = 0; 32 32 virtual vertex_array* create_vertex_array() = 0; 33 virtual texture2d* create_texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler, void* data = nullptr ) = 0;33 virtual texture2d* create_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data = nullptr ) = 0; 34 34 }; 35 35 -
trunk/nv/interface/program.hh
r50 r62 28 28 const string& name, 29 29 int location, 30 type type,30 etype type, 31 31 int length ) : 32 32 m_name( name ), … … 40 40 const string& get_name() const { return m_name; } 41 41 int get_location() const { return m_location; } 42 type get_type() const { return m_type; }42 etype get_type() const { return m_type; } 43 43 int get_length() const { return m_length; } 44 44 … … 46 46 string m_name; 47 47 int m_location; 48 typem_type;48 etype m_type; 49 49 int m_length; 50 50 }; … … 53 53 { 54 54 public: 55 uniform_base( const string& name, type type, int location, int length )55 uniform_base( const string& name, etype type, int location, int length ) 56 56 : m_name( name ), m_type( type ), m_location(location), m_length( length ), m_dirty( true ) {} 57 type get_type() const { return m_type; }57 etype get_type() const { return m_type; } 58 58 int get_location() const { return m_location; } 59 59 int get_length() const { return m_length; } … … 62 62 protected: 63 63 string m_name; 64 typem_type;65 int m_location;66 int m_length;67 bool m_dirty;64 etype m_type; 65 int m_location; 66 int m_length; 67 bool m_dirty; 68 68 }; 69 69 … … 164 164 } 165 165 protected: 166 uniform_base* create_uniform( type utype, const string& name, int location, int length )166 uniform_base* create_uniform( etype utype, const string& name, int location, int length ) 167 167 { 168 168 switch( utype ) -
trunk/nv/interface/texture2d.hh
r49 r62 60 60 public: 61 61 62 texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler ) :62 texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler ) : 63 63 m_size( size ), m_format( aformat ), m_datatype( adatatype ), m_sampler( asampler ) {} 64 64 virtual void assign( void* data ) = 0; … … 70 70 int get_height() const { return m_size.y; } 71 71 image_format get_format() const { return m_format; } 72 type get_datatype() const { return m_datatype; }72 etype get_datatype() const { return m_datatype; } 73 73 const sampler& get_sampler() const { return m_sampler; } 74 74 protected: 75 75 ivec2 m_size; 76 76 image_format m_format; 77 type m_datatype;77 etype m_datatype; 78 78 sampler m_sampler; 79 79 }; -
trunk/nv/interface/vertex_buffer.hh
r44 r62 58 58 { 59 59 public: 60 vertex_buffer_attribute( vertex_buffer* buffer, type datatype, int components, int offset = 0, int stride = 0, bool owner = true )60 vertex_buffer_attribute( vertex_buffer* buffer, etype datatype, int components, int offset = 0, int stride = 0, bool owner = true ) 61 61 : m_buffer( buffer ), m_datatype( datatype ), m_components( components ), m_offset( offset ), m_stride( stride ), m_owner( owner ) {} 62 62 63 63 vertex_buffer* get_buffer() const { return m_buffer; } 64 type get_datatype() const { return m_datatype; }64 etype get_datatype() const { return m_datatype; } 65 65 int get_components() const { return m_components; } 66 66 int get_offset() const { return m_offset; } … … 76 76 protected: 77 77 vertex_buffer* m_buffer; 78 type m_datatype;78 etype m_datatype; 79 79 int m_components; 80 80 int m_offset; … … 89 89 public: 90 90 vertex_array() : m_map(), m_index( nullptr ) {} 91 void add_vertex_buffer( int location, vertex_buffer* buffer, type datatype, int components, int offset = 0, int stride = 0, bool owner = true )91 void add_vertex_buffer( int location, vertex_buffer* buffer, etype datatype, int components, int offset = 0, int stride = 0, bool owner = true ) 92 92 { 93 93 m_map[ location ] = new vertex_buffer_attribute( buffer, datatype, components, offset, stride, owner ); -
trunk/nv/lib/sdl12.hh
r19 r62 1019 1019 NV_SDL_FUN( void, SDL_SetEventFilter, (SDL_EventFilter filter) ); 1020 1020 NV_SDL_FUN( SDL_EventFilter, SDL_GetEventFilter, (void) ); 1021 NV_SDL_FUN( Uint8, SDL_EventState, (Uint8 type, int state) );1021 NV_SDL_FUN( Uint8, SDL_EventState, (Uint8 etype, int state) ); 1022 1022 1023 1023 #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) -
trunk/nv/lib/sdl_image.hh
r19 r62 41 41 NV_SDL_FUN( int, IMG_Init, (int flags) ); 42 42 NV_SDL_FUN( void, IMG_Quit, (void) ); 43 NV_SDL_FUN( SDL_Surface *, IMG_LoadTyped_RW, (SDL_RWops *src, int freesrc, char * type) );43 NV_SDL_FUN( SDL_Surface *, IMG_LoadTyped_RW, (SDL_RWops *src, int freesrc, char *etype) ); 44 44 NV_SDL_FUN( SDL_Surface *, IMG_Load, (const char *file) ); 45 45 NV_SDL_FUN( SDL_Surface *, IMG_Load_RW, (SDL_RWops *src, int freesrc) ); -
trunk/nv/types.hh
r61 r62 20 20 { 21 21 22 enum type22 enum etype 23 23 { 24 24 INT, … … 52 52 typedef glm::mat4 mat4; 53 53 54 template < type EnumType > struct enum_to_type {};54 template < etype EnumType > struct enum_to_type {}; 55 55 56 56 template <> struct enum_to_type< INT > { typedef int type; }; … … 76 76 template < typename TYPE > struct type_to_enum {}; 77 77 78 template <> struct type_to_enum< int > { static const type type = INT; };79 template <> struct type_to_enum< unsigned int > { static const type type = UINT; };80 template <> struct type_to_enum< short > { static const type type = SHORT; };81 template <> struct type_to_enum< unsigned short >{ static const type type = USHORT; };82 template <> struct type_to_enum< char > { static const type type = BYTE; };83 template <> struct type_to_enum< unsigned char > { static const type type = UBYTE; };84 template <> struct type_to_enum< f32 > { static const type type = FLOAT; };85 86 template <> struct type_to_enum< vec2 > { static const type type = FLOAT_VECTOR_2; };87 template <> struct type_to_enum< vec3 > { static const type type = FLOAT_VECTOR_3; };88 template <> struct type_to_enum< vec4 > { static const type type = FLOAT_VECTOR_4; };89 90 template <> struct type_to_enum< ivec2 > { static const type type = INT_VECTOR_2; };91 template <> struct type_to_enum< ivec3 > { static const type type = INT_VECTOR_3; };92 template <> struct type_to_enum< ivec4 > { static const type type = INT_VECTOR_4; };93 94 template <> struct type_to_enum< mat2 > { static const type type = FLOAT_MATRIX_2; };95 template <> struct type_to_enum< mat3 > { static const type type = FLOAT_MATRIX_3; };96 template <> struct type_to_enum< mat4 > { static const type type = FLOAT_MATRIX_4; };78 template <> struct type_to_enum< int > { static const etype type = INT; }; 79 template <> struct type_to_enum< unsigned int > { static const etype type = UINT; }; 80 template <> struct type_to_enum< short > { static const etype type = SHORT; }; 81 template <> struct type_to_enum< unsigned short >{ static const etype type = USHORT; }; 82 template <> struct type_to_enum< char > { static const etype type = BYTE; }; 83 template <> struct type_to_enum< unsigned char > { static const etype type = UBYTE; }; 84 template <> struct type_to_enum< f32 > { static const etype type = FLOAT; }; 85 86 template <> struct type_to_enum< vec2 > { static const etype type = FLOAT_VECTOR_2; }; 87 template <> struct type_to_enum< vec3 > { static const etype type = FLOAT_VECTOR_3; }; 88 template <> struct type_to_enum< vec4 > { static const etype type = FLOAT_VECTOR_4; }; 89 90 template <> struct type_to_enum< ivec2 > { static const etype type = INT_VECTOR_2; }; 91 template <> struct type_to_enum< ivec3 > { static const etype type = INT_VECTOR_3; }; 92 template <> struct type_to_enum< ivec4 > { static const etype type = INT_VECTOR_4; }; 93 94 template <> struct type_to_enum< mat2 > { static const etype type = FLOAT_MATRIX_2; }; 95 template <> struct type_to_enum< mat3 > { static const etype type = FLOAT_MATRIX_3; }; 96 template <> struct type_to_enum< mat4 > { static const etype type = FLOAT_MATRIX_4; }; 97 97 98 98 template <typename TYPE> -
trunk/src/gl/gl_device.cc
r49 r62 67 67 } 68 68 69 texture2d* gl_device::create_texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler, void* data /*= nullptr */ )69 texture2d* gl_device::create_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data /*= nullptr */ ) 70 70 { 71 71 return new gl_texture2d( size, aformat, adatatype, asampler, data ); -
trunk/src/gl/gl_enum.cc
r49 r62 185 185 } 186 186 187 unsigned int nv::type_to_gl_enum( type type )187 unsigned int nv::type_to_gl_enum( etype type ) 188 188 { 189 189 switch( type ) … … 209 209 } 210 210 211 nv:: type nv::gl_enum_to_type( unsigned int gl_enum )211 nv::etype nv::gl_enum_to_type( unsigned int gl_enum ) 212 212 { 213 213 switch( gl_enum ) … … 229 229 case GL_INT_VEC3 : return INT_VECTOR_3; 230 230 case GL_INT_VEC4 : return INT_VECTOR_4; 231 default : return type(0); // TODO: throw!232 } 233 } 231 default : return etype(0); // TODO: throw! 232 } 233 } -
trunk/src/gl/gl_program.cc
r41 r62 180 180 181 181 int uni_loc = glGetUniformLocation( m_name.get_value(), name.c_str() ); 182 type utype = gl_enum_to_type( uni_type );182 etype utype = gl_enum_to_type( uni_type ); 183 183 m_uniform_map[ name ] = create_uniform( utype, name, uni_loc, uni_len ); 184 184 } -
trunk/src/gl/gl_texture2d.cc
r49 r62 10 10 using namespace nv; 11 11 12 nv::gl_texture2d::gl_texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler, void* data /*= nullptr */ )12 nv::gl_texture2d::gl_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data /*= nullptr */ ) 13 13 : texture2d( size, aformat, adatatype, asampler ), m_name() 14 14 { -
trunk/tests/lualib_test/lualib_test.cc
r53 r62 3 3 #include <nv/lua/lua_glm.hh> 4 4 #include <nv/logger.hh> 5 #include <nv/types.hh> 6 #include <nv/object.hh> 5 7 #include <string> 6 8 #include <iostream> 9 #include <functional> 10 11 struct test_struct 12 { 13 std::string f; 14 int i; 15 }; 16 17 NV_REGISTER_NAME( test_struct ) 7 18 8 19 int main(int, char* []) 9 20 { 21 nv::type_database db; 22 nv::object::register_type( &db ); 23 24 db.create_type<int>(); 25 db.create_type<std::string>(); 26 nv::type_field fields[] = { 27 nv::type_field("f", &test_struct::f ), 28 nv::type_field("i", &test_struct::i ), 29 }; 30 db.create_type<test_struct>().fields( fields ); 31 32 10 33 nv::logger log(nv::LOG_TRACE); 11 34 log.add_sink( new nv::log_file_sink("log.txt"), nv::LOG_TRACE ); 12 35 log.add_sink( new nv::log_console_sink(), nv::LOG_TRACE ); 13 36 nv::load_lua_library(); 14 37 15 38 NV_LOG( nv::LOG_NOTICE, "Logging started" ); 16 39 … … 38 61 luaL_dofile(lua_state, "init.lua"); 39 62 40 while (true)63 for (;;) 41 64 { 42 65 std::string input;
Note: See TracChangeset
for help on using the changeset viewer.