Changeset 62


Ignore:
Timestamp:
05/30/13 16:44:38 (12 years ago)
Author:
epyon
Message:
  • type -> etype - to reduce confusion for the compiler
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/gl/gl_device.hh

    r49 r62  
    2626                virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr );
    2727                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 );
    2929                virtual ~gl_device();
    3030        private:
  • trunk/nv/gl/gl_enum.hh

    r49 r62  
    3737        unsigned int primitive_to_enum( primitive p );
    3838
    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 );
    4141
    4242} // namespace nv
  • trunk/nv/gl/gl_texture2d.hh

    r49 r62  
    2222        {
    2323        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 );
    2525                virtual void assign( void* data );
    2626                virtual void bind( int slot = 0 );
  • trunk/nv/interface/device.hh

    r49 r62  
    3131                virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr ) = 0;
    3232                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;
    3434        };
    3535
  • trunk/nv/interface/program.hh

    r50 r62  
    2828                        const string& name,
    2929                        int location,
    30                         type type,
     30                        etype type,
    3131                        int length ) :
    3232                        m_name( name ),
     
    4040                const string& get_name() const { return m_name; }
    4141                int get_location() const { return m_location; }
    42                 type get_type() const { return m_type; }
     42                etype get_type() const { return m_type; }
    4343                int get_length() const { return m_length; }
    4444
     
    4646                string m_name;
    4747                int    m_location;
    48                 type   m_type;
     48                etype  m_type;
    4949                int    m_length;
    5050        };
     
    5353        {
    5454        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 )
    5656                        : 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; }
    5858                int get_location() const { return m_location; }
    5959                int get_length() const { return m_length; }
     
    6262        protected:
    6363                string m_name;
    64                 type m_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;
    6868        };
    6969
     
    164164                }
    165165        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 )
    167167                {
    168168                        switch( utype )
  • trunk/nv/interface/texture2d.hh

    r49 r62  
    6060        public:
    6161
    62                 texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler ) :
     62                texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler ) :
    6363                        m_size( size ), m_format( aformat ), m_datatype( adatatype ), m_sampler( asampler ) {}
    6464                virtual void assign( void* data ) = 0;
     
    7070                int get_height() const { return m_size.y; }
    7171                image_format get_format() const { return m_format; }
    72                 type get_datatype() const { return m_datatype; }
     72                etype get_datatype() const { return m_datatype; }
    7373                const sampler& get_sampler() const { return m_sampler; }
    7474        protected:
    7575                ivec2        m_size;
    7676                image_format m_format;
    77                 type         m_datatype;
     77                etype         m_datatype;
    7878                sampler      m_sampler;
    7979        };
  • trunk/nv/interface/vertex_buffer.hh

    r44 r62  
    5858        {
    5959        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 )
    6161                        : m_buffer( buffer ), m_datatype( datatype ), m_components( components ), m_offset( offset ), m_stride( stride ), m_owner( owner ) {}
    6262
    6363                vertex_buffer* get_buffer() const { return m_buffer; }
    64                 type get_datatype() const { return m_datatype; }
     64                etype get_datatype() const { return m_datatype; }
    6565                int get_components() const { return m_components; }
    6666                int get_offset() const { return m_offset; }
     
    7676        protected:
    7777                vertex_buffer* m_buffer;
    78                 type           m_datatype;
     78                etype           m_datatype;
    7979                int  m_components;
    8080                int  m_offset;
     
    8989        public:
    9090                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 )
    9292                {
    9393                        m_map[ location ] = new vertex_buffer_attribute( buffer, datatype, components, offset, stride, owner );
  • trunk/nv/lib/sdl12.hh

    r19 r62  
    10191019NV_SDL_FUN( void, SDL_SetEventFilter, (SDL_EventFilter filter) );
    10201020NV_SDL_FUN( SDL_EventFilter, SDL_GetEventFilter, (void) );
    1021 NV_SDL_FUN( Uint8, SDL_EventState, (Uint8 type, int state) );
     1021NV_SDL_FUN( Uint8, SDL_EventState, (Uint8 etype, int state) );
    10221022
    10231023#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
  • trunk/nv/lib/sdl_image.hh

    r19 r62  
    4141NV_SDL_FUN( int, IMG_Init, (int flags) );
    4242NV_SDL_FUN( void, IMG_Quit, (void) );
    43 NV_SDL_FUN( SDL_Surface *, IMG_LoadTyped_RW, (SDL_RWops *src, int freesrc, char *type) );
     43NV_SDL_FUN( SDL_Surface *, IMG_LoadTyped_RW, (SDL_RWops *src, int freesrc, char *etype) );
    4444NV_SDL_FUN( SDL_Surface *, IMG_Load, (const char *file) );
    4545NV_SDL_FUN( SDL_Surface *, IMG_Load_RW, (SDL_RWops *src, int freesrc) );
  • trunk/nv/types.hh

    r61 r62  
    2020{
    2121
    22         enum type
     22        enum etype
    2323        {
    2424                INT,
     
    5252        typedef glm::mat4 mat4;
    5353
    54         template < type EnumType > struct enum_to_type {};
     54        template < etype EnumType > struct enum_to_type {};
    5555
    5656        template <> struct enum_to_type< INT >   { typedef int type; };
     
    7676        template < typename TYPE > struct type_to_enum {};
    7777
    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; };
    9797
    9898        template <typename TYPE>
  • trunk/src/gl/gl_device.cc

    r49 r62  
    6767}
    6868
    69 texture2d* gl_device::create_texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler, void* data /*= nullptr */ )
     69texture2d* gl_device::create_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data /*= nullptr */ )
    7070{
    7171        return new gl_texture2d( size, aformat, adatatype, asampler, data );
  • trunk/src/gl/gl_enum.cc

    r49 r62  
    185185}
    186186
    187 unsigned int nv::type_to_gl_enum( type type )
     187unsigned int nv::type_to_gl_enum( etype type )
    188188{
    189189        switch( type )
     
    209209}
    210210
    211 nv::type nv::gl_enum_to_type( unsigned int gl_enum )
     211nv::etype nv::gl_enum_to_type( unsigned int gl_enum )
    212212{
    213213        switch( gl_enum )
     
    229229        case GL_INT_VEC3       : return INT_VECTOR_3;
    230230        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  
    180180
    181181                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 );
    183183                m_uniform_map[ name ] = create_uniform( utype, name, uni_loc, uni_len );
    184184        }
  • trunk/src/gl/gl_texture2d.cc

    r49 r62  
    1010using namespace nv;
    1111
    12 nv::gl_texture2d::gl_texture2d( ivec2 size, image_format aformat, type adatatype, sampler asampler, void* data /*= nullptr */ )
     12nv::gl_texture2d::gl_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data /*= nullptr */ )
    1313        : texture2d( size, aformat, adatatype, asampler ), m_name()
    1414{
  • trunk/tests/lualib_test/lualib_test.cc

    r53 r62  
    33#include <nv/lua/lua_glm.hh>
    44#include <nv/logger.hh>
     5#include <nv/types.hh>
     6#include <nv/object.hh>
    57#include <string>
    68#include <iostream>
     9#include <functional>
     10
     11struct test_struct
     12{
     13        std::string f;
     14        int i;
     15};
     16
     17NV_REGISTER_NAME( test_struct )
    718
    819int main(int, char* [])
    920{
     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
    1033        nv::logger log(nv::LOG_TRACE);
    1134        log.add_sink( new nv::log_file_sink("log.txt"), nv::LOG_TRACE );
    1235        log.add_sink( new nv::log_console_sink(), nv::LOG_TRACE );
    1336        nv::load_lua_library();
    14                
     37       
    1538        NV_LOG( nv::LOG_NOTICE, "Logging started" );
    1639
     
    3861        luaL_dofile(lua_state, "init.lua");
    3962
    40         while (true)
     63        for (;;)
    4164        {
    4265                std::string input;
Note: See TracChangeset for help on using the changeset viewer.