Changeset 121 for trunk


Ignore:
Timestamp:
06/15/13 17:47:57 (12 years ago)
Author:
epyon
Message:
  • Nova builds with -Weverything/-Wall/-pedantic/etc on: on MSVC 2012 on GCC 4.6.3 on clang 3.2
  • ... without a single fucking warning.
Location:
trunk
Files:
51 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv.lua

    r120 r121  
    1212                includedirs { os.getenv("GLM_PATH") }
    1313        configuration "gmake"
    14                 buildoptions "-std=c++0x"
     14                if _ACTION == "gmake-clang" then
     15                        buildoptions {
     16                                "-std=c++11",
     17                                "-Weverything",
     18                                -- obviously we don't care about C++98 compatibility
     19                                "-Wno-c++98-compat",
     20                                -- obviously we don't care about C++98 compatibility
     21                                "-Wno-c++98-compat-pedantic",
     22                                -- an evil one has to embrace
     23                                "-Wno-float-equal",
     24                                -- padding is a non-issue at the moment
     25                                "-Wno-padded",
     26                                -- we don't want to list all 128 keys of the key
     27                                -- enum each time, right?
     28                                "-Wno-switch-enum",
     29                                -- yes, we need exit time destructors for libraries
     30                                "-Wno-exit-time-destructors",
     31                                -- same here
     32                                "-Wno-global-constructors",
     33                                -- no reasonable way to fix this with abstract
     34                                -- interfaces.
     35                                "-Wno-weak-vtables"
     36                        }
     37                else
     38                        buildoptions { "-std=c++0x" }
     39                end
     40
    1541        configuration "vs*"
    1642                defines { "_SECURE_SCL=0", "_CRT_SECURE_NO_WARNINGS=1" }
  • trunk/nv/common.hh

    r120 r121  
    128128}
    129129
     130// MSVC and GCC is too stupid to notice fully covered enums, clang
     131// is picky about it
     132#if NV_COMPILER == NV_CLANG
     133#define NV_RETURN_COVERED_DEFAULT( value )
     134#else
     135#define NV_RETURN_COVERED_DEFAULT( value ) default : return value
     136#endif
     137
     138
    130139namespace nv
    131140{
  • trunk/nv/gfx/cached_buffer.hh

    r120 r121  
    1212
    1313#include <nv/common.hh>
     14#include <nv/math.hh>
    1415#include <nv/interface/vertex_buffer.hh>
    1516
     
    109110                        if ( !m_full_update && resized )
    110111                        {
    111                                 m_data.erase( m_data.begin() + offset, m_data.end() );
    112                                 m_min = glm::min<int>( m_min, offset );
     112                                m_data.erase( m_data.begin() + (int)offset, m_data.end() );
     113                                m_min = nv::min<size_t>( m_min, offset );
    113114                                m_full_update = true;
    114115                        }
     
    120121                        else if ( updated )
    121122                        {
    122                                 std::copy( bv.cbegin(), bv.cend(), m_data.begin() + offset );
    123                                 m_min = glm::min<size_t>( m_min, offset );
    124                                 m_max = glm::max<size_t>( m_max, offset + bv.size() );
     123                                std::copy( bv.cbegin(), bv.cend(), m_data.begin() + (int)offset );
     124                                m_min = nv::min<size_t>( m_min, offset );
     125                                m_max = nv::max<size_t>( m_max, offset + bv.size() );
    125126                        }
    126127                        return m_full_update;
     
    166167                        {
    167168                                m_buffer->bind();
    168                                 int offset = m_min * value_type_size;
    169                                 int size   = (m_max-m_min) * value_type_size;
     169                                size_t offset = m_min * value_type_size;
     170                                size_t size   = (m_max-m_min) * value_type_size;
    170171                                m_buffer->update( m_data.data() + m_min, offset, size );
    171172                                m_buffer->unbind();
     
    177178                }
    178179
    179                 int get_max_size() const
     180                size_t get_max_size() const
    180181                {
    181182                        return m_buffer->get_size() / value_type_size;
    182183                }
    183184
    184                 int get_size() const
     185                size_t get_size() const
    185186                {
    186187                        return m_data.size();
     
    197198                }
    198199        private:
    199                 void create_buffer( int size )
     200                void create_buffer( size_t size )
    200201                {
    201202                        delete m_buffer;
  • trunk/nv/gfx/image.hh

    r110 r121  
    99
    1010#include <nv/common.hh>
     11#include <nv/math.hh>
    1112#include <nv/interface/image_data.hh>
    12 #include <glm/glm.hpp>
    1313
    1414namespace nv
     
    1919        struct region
    2020        {
    21                 glm::ivec2 pos;
    22                 glm::ivec2 size;
     21                ivec2 pos;
     22                ivec2 size;
    2323
    2424                region() : pos(0,0), size(0,0) {}
    25                 region( glm::ivec2 pos, glm::ivec2 size ) : pos(pos), size(size) {}
     25                region( ivec2 apos, ivec2 asize ) : pos(apos), size(asize) {}
    2626        };
    2727
     
    4242                 * @arg[in] depth :  Depth of the image.
    4343                 */
    44                 image( glm::ivec2 size, size_t depth );
     44                image( ivec2 size, size_t depth );
    4545                /**
    4646                 * Constructor
     
    6161                 *      reversed or not.
    6262                 */
    63                 image( glm::ivec2 size, size_t depth, const uint8 * data, bool reversed = false );
     63                image( ivec2 size, size_t depth, const uint8 * data, bool reversed = false );
    6464                /**
    6565                 * Fills the image with a given value.
     
    7575                 * @arg[in] stride :
    7676                 */
    77                 void set_region( region r, const uint8 * data, size_t stride = 0 );
     77                void set_region( region r, const uint8 * data, int stride = 0 );
    7878                /**
    7979                 * Default destructor. Deallocates data.
     
    9191                 * @return Returns the size of the image as a vector.
    9292                 */
    93                 const glm::ivec2 get_size() const { return m_size; }
     93                ivec2 get_size() const { return m_size; }
    9494                /**
    9595                 * Getter for depth.
     
    9797                 * @return Returns depth of the image.
    9898                 */
    99                 const size_t get_depth() const { return m_depth; }
     99                size_t get_depth() const { return m_depth; }
    100100        protected:
    101                 /** Defines the size of the image as a vector. */
    102                 glm::ivec2 m_size;
    103                 /** Deefines the depth of the image. */
    104                 size_t     m_depth;
    105                 /** Holder for data. */
    106                 uint8*     m_data;
     101                ivec2  m_size;  //!< Defines the size of the image as a vector.
     102                size_t m_depth; //!< Defines the depth of the image
     103                uint8* m_data;  //!< Holder for data
    107104        };
    108105
  • trunk/nv/gfx/texture_atlas.hh

    r96 r121  
    99
    1010#include <nv/common.hh>
     11#include <nv/math.hh>
    1112#include <nv/gfx/image.hh>
    12 #include <glm/glm.hpp>
    1313#include <vector>
    1414
     
    1919        {
    2020        public:
    21                 texture_atlas( glm::ivec2 size, size_t depth );
    22                 region get_region( glm::ivec2 size );
     21                texture_atlas( ivec2 size, size_t depth );
     22                region get_region( ivec2 size );
    2323                void clear();
    24                 const size_t get_used() const { return m_used; }
     24                size_t get_used() const { return m_used; }
    2525        protected:
    26                 int fit( size_t index, glm::ivec2 size );
     26                int fit( size_t index, ivec2 size );
    2727                void merge();
    2828        private:
    2929                size_t  m_used;
    30                 std::vector<glm::ivec3> m_nodes;
     30                std::vector<ivec3> m_nodes;
    3131        };
    3232
  • trunk/nv/gfx/texture_font.hh

    r110 r121  
    1010#include <nv/common.hh>
    1111#include <string>
     12#include <unordered_map>
     13#include <nv/math.hh>
    1214#include <nv/gfx/texture_atlas.hh>
    13 #include <glm/glm.hpp>
    14 #include <unordered_map>
    1515
    1616namespace nv
     
    1818        struct texture_glyph
    1919        {
    20                 uint16 charcode; ///< Character code value.
    21                 glm::ivec2 size; ///< Width and height of the glyph.
    22                 glm::ivec2 offset; ///< Offset of the glyph's position from the base line.
    23                 glm::vec2 advance; ///< Cursor advance distance.
    24                 glm::vec2 tl; ///< Top-left of the glyph's bounding box.
    25                 glm::vec2 br; ///< Bottom-right of the glyph's bounding box.
    26                 std::unordered_map< uint16, float > kerning; ///< Kerning space between other characters.
     20                uint16 charcode;//!< Character code value.
     21                ivec2  size;    //!< Width and height of the glyph.
     22                ivec2  offset;  //!< Offset of the glyph's position from the base line.
     23                vec2   advance; //!< Cursor advance distance.
     24                vec2   tl;      //!< Top-left of the glyph's bounding box.
     25                vec2   br;      //!< Bottom-right of the glyph's bounding box.
     26                std::unordered_map< uint16, float > kerning; //!< Kerning space between other characters.
    2727
    2828                /**
     
    3434                 *Gets the kerning space between this character and the requested character.
    3535                 *
    36                  *@param charcode The character to get the spacing for.
     36                 *@param other The character to get the spacing for.
    3737                 *@returns The amount of space for kerning.
    3838                 */
    39                 float get_kerning( const uint16 charcode );
     39                float get_kerning( const uint16 other );
    4040        };
    4141
     
    4646                        const texture_glyph* get_glyph( uint16 charcode ) const;
    4747                        bool load_glyphs( const std::string& codes );
     48                        float get_size() const { return m_size; }
    4849                        ~texture_font();
    4950                private:
    5051                        void generate_kerning();
    5152                private:
    52                         std::unordered_map< uint16, texture_glyph > m_glyphs; ///< Hash table of glyphs for this font.
    53                         texture_atlas* m_atlas; ///< Atlas Image object for this font.
    54                         std::string m_filename; ///< Name of the file.
    55                         float m_size; ///< Font size.
    56                         float m_height; ///< Height of the font. (x-height?)
    57                         float m_linegap; ///< Amount of space between lines.
    58                         float m_ascender; ///< Height of ascender lines (lines extending above the glyph's x-height).
    59                         float m_descender; ///< Height of descender lines (lines extending below the glyph's x-height).
    60                         bool m_hinting; ///< Whether or not glyph hints are used.
    61                         bool m_filtering; ///< Whether or not glyphs are color filtered for LCD displays.
    62                         uint8 m_lcd_weights[5]; ///< Color filtering weights.
    63                         void* m_rlibrary; ///< Pointer to the library.
    64                         void* m_rface; ///< Pointer to the font face.
     53                        std::unordered_map< uint16, texture_glyph > m_glyphs; //!< Hash table of glyphs for this font.
     54
     55                        texture_atlas* m_atlas; //!< Atlas Image object for this font.
     56                        std::string m_filename; //!< Name of the file.
     57                        float m_size;           //!< Font size.
     58                        float m_height;         //!< Height of the font. (x-height?)
     59                        float m_linegap;        //!< Amount of space between lines.
     60                        float m_ascender;       //!< Height of ascender lines (lines extending above the glyph's x-height).
     61                        float m_descender;      //!< Height of descender lines (lines extending below the glyph's x-height).
     62                        bool m_hinting;         //!< Whether or not glyph hints are used.
     63                        bool m_filtering;       //!< Whether or not glyphs are color filtered for LCD displays.
     64                        uint8 m_lcd_weights[5]; //!< Color filtering weights.
     65                        void* m_rlibrary;       //!< Pointer to the library.
     66                        void* m_rface;          //!< Pointer to the font face.
    6567        };
    6668}
  • trunk/nv/gl/gl_context.hh

    r45 r121  
    2323                virtual void clear( const clear_state& cs );
    2424                // temporary
    25                 virtual void draw( primitive prim, const render_state& rs, program* p, vertex_array* va, int count );
     25                virtual void draw( primitive prim, const render_state& rs, program* p, vertex_array* va, size_t count );
    2626                virtual const ivec4& get_viewport();
    2727                virtual void set_viewport( const ivec4& viewport );
     
    2929        private:
    3030                void force_apply_render_state( const render_state& state );
    31                 void force_apply_stencil_face( int face, const stencil_test_face& stencil );
     31                void force_apply_stencil_face( unsigned face, const stencil_test_face& stencil );
    3232                void apply_stencil_test( const stencil_test& stencil );
    33                 void apply_stencil_face( int face, stencil_test_face& stencil, const stencil_test_face& new_stencil );
     33                void apply_stencil_face( unsigned face, stencil_test_face& stencil, const stencil_test_face& new_stencil );
    3434                void apply_scissor_test( const scissor_test& scissor );
    3535                void apply_depth_test( const depth_test& depth );
  • trunk/nv/gl/gl_device.hh

    r92 r121  
    2323                virtual window* create_window( uint16 width, uint16 height );
    2424                virtual program* create_program( const string& vs_source, const string& fs_source );
    25                 virtual vertex_buffer* create_vertex_buffer( buffer_hint hint, int size, void* source = nullptr );
    26                 virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr );
     25                virtual vertex_buffer* create_vertex_buffer( buffer_hint hint, size_t size, void* source = nullptr );
     26                virtual index_buffer* create_index_buffer( buffer_hint hint, size_t size, void* source = nullptr );
    2727                virtual vertex_array* create_vertex_array();
    2828                virtual image_data* create_image_data( const std::string& filename ); // temporary
  • trunk/nv/gl/gl_names.hh

    r35 r121  
    2121        {
    2222        public:
    23                 gl_name() : m_value( 0 ) {};
    24                 int get_value() const { return m_value; }
     23                gl_name() : m_value( 0 ) {}
     24                unsigned get_value() const { return m_value; }
    2525                bool is_valid() const { return m_value != 0; }
    2626        protected:
  • trunk/nv/gl/gl_program.hh

    r41 r121  
    2424        {
    2525        public:
    26                 explicit gl_shader( uint32 shader_type );
    27                 gl_shader( uint32 shader_type, const string& shader_code );
     26                explicit gl_shader( uint32 sh_type );
     27                gl_shader( uint32 sh_type, const string& shader_code );
    2828                ~gl_shader();
    2929
  • trunk/nv/gl/gl_texture2d.hh

    r70 r121  
    2424                gl_texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler, void* data = nullptr );
    2525                virtual void assign( void* data );
    26                 virtual void bind( int slot = 0 );
     26                virtual void bind( size_t slot = 0 );
    2727                virtual void unbind();
    2828                virtual bool is_valid() const;
  • trunk/nv/gl/gl_vertex_buffer.hh

    r100 r121  
    2222        {
    2323        public:
    24                 gl_vertex_buffer( buffer_hint hint, int size, void* data = nullptr );
    25                 virtual void update( void* data, int offset, int size );
     24                gl_vertex_buffer( buffer_hint hint, size_t size, void* data = nullptr );
     25                virtual void update( void* data, size_t offset, size_t size );
    2626                virtual void bind();
    2727                virtual void unbind();
     
    3434        {
    3535        public:
    36                 gl_index_buffer( buffer_hint hint, int size, void* data = nullptr );
    37                 virtual void update( void* data, int offset, int size );
     36                gl_index_buffer( buffer_hint hint, size_t size, void* data = nullptr );
     37                virtual void update( void* data, size_t offset, size_t size );
    3838                virtual void bind();
    3939                virtual void unbind();
  • trunk/nv/gl/gl_window.hh

    r98 r121  
    3030                virtual bool poll_event( io_event& event );
    3131                virtual context* get_context() { return m_context; }
    32                 virtual device* get_device() { return m_device; };
     32                virtual device* get_device() { return m_device; }
    3333
    3434                virtual void swap_buffers();
  • trunk/nv/gui/gui_style.hh

    r104 r121  
    3636                        bool resolve( element* e, const std::string& entry, int type );
    3737                protected:
    38                         lua::state m_lua; //< separate lua state for style calculation
     38                        lua::state m_lua; //!< separate lua state for style calculation
    3939                };
    4040
  • trunk/nv/interface/clear_state.hh

    r120 r121  
    2828
    2929                color_mask() : red( true ), green( true ), blue( true ), alpha( true ) {}
    30                 color_mask( bool red, bool green, bool blue, bool alpha )
    31                         : red( red ), green( green ), blue( blue ), alpha( alpha ) {}
     30                color_mask( bool r, bool g, bool b, bool a )
     31                        : red( r ), green( g ), blue( b ), alpha( a ) {}
    3232
    3333                bool operator==(const color_mask& rhs) const
  • trunk/nv/interface/context.hh

    r45 r121  
    3737                virtual void clear( const clear_state& cs ) = 0;
    3838                // temporary
    39                 virtual void draw( primitive prim, const render_state& rs, program* p, vertex_array* va, int count ) = 0;
     39                virtual void draw( primitive prim, const render_state& rs, program* p, vertex_array* va, size_t count ) = 0;
    4040                virtual void apply_render_state( const render_state& state ) = 0;
    4141                virtual const ivec4& get_viewport() = 0;
    4242                virtual void set_viewport( const ivec4& viewport ) = 0;
     43                virtual ~context() {}
    4344        protected:
    4445                clear_state  m_clear_state;
  • trunk/nv/interface/device.hh

    r116 r121  
    3030                virtual window* create_window( uint16 width, uint16 height ) = 0;
    3131                virtual program* create_program( const string& vs_source, const string& fs_source ) = 0;
    32                 virtual vertex_buffer* create_vertex_buffer( buffer_hint hint, int size, void* source = nullptr ) = 0;
    33                 virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr ) = 0;
     32                virtual vertex_buffer* create_vertex_buffer( buffer_hint hint, size_t size, void* source = nullptr ) = 0;
     33                virtual index_buffer* create_index_buffer( buffer_hint hint, size_t size, void* source = nullptr ) = 0;
    3434                virtual vertex_array* create_vertex_array() = 0;
    3535                virtual image_data* create_image_data( const std::string& filename ) = 0; // temporary
     
    5555                        return result;
    5656                }
     57                virtual ~device() {}
    5758        };
    5859
  • trunk/nv/interface/image_data.hh

    r95 r121  
    1515
    1616#include <nv/common.hh>
     17#include <nv/math.hh>
    1718#include <algorithm>
    18 #include <glm/glm.hpp>
    1919
    2020namespace nv
     
    2323        {
    2424        public:
    25                 image_data( glm::ivec2 size, size_t depth, const uint8 * data )
     25                image_data( ivec2 size, size_t depth, const uint8 * data )
    2626                        : m_size( size ), m_depth( depth ), m_data( nullptr )
    2727                {
    28                         std::size_t bsize = m_size.x * m_size.y * m_depth;
     28                        std::size_t bsize = static_cast<std::size_t>(m_size.x * m_size.y) * m_depth;
    2929                        m_data = new uint8[ bsize ];
    3030                        std::copy( data, data + bsize, m_data );
     
    3232                uint8* release_data() { uint8* r = m_data; m_data = nullptr; return r; }
    3333                const uint8 * get_data()    const { return m_data; }
    34                 const glm::ivec2 get_size() const { return m_size; }
    35                 const size_t get_depth()    const { return m_depth; }
     34                const ivec2 get_size() const { return m_size; }
     35                size_t get_depth()    const { return m_depth; }
    3636                ~image_data() { if (m_data) delete[] m_data; }
    3737        private:
    38                 glm::ivec2 m_size;  //< Defines the size of the image as a vector
    39                 size_t     m_depth; //< Defines the depth of the image
    40                 uint8*     m_data;  //< Holder for data
     38                ivec2  m_size;  //!< Defines the size of the image as a vector
     39                size_t m_depth; //!< Defines the depth of the image
     40                uint8* m_data;  //!< Holder for data
    4141        };
    4242}
  • trunk/nv/interface/mesh.hh

    r111 r121  
    3535                virtual size_t get_size() const = 0;
    3636                virtual void* get_data() const = 0;
    37                 virtual ~vertex_attribute_base() {};
     37                virtual ~vertex_attribute_base() {}
    3838        private:
    3939                string m_name;
     
    5252                const list& get() const { return m_list; }
    5353                list& get() { return m_list; }
    54                 virtual datatype get_base_type() const { return type_to_enum<base_type>::type; };
    55                 virtual size_t get_components() const { return datatype_traits<T>::size; };
     54                virtual datatype get_base_type() const { return type_to_enum<base_type>::type; }
     55                virtual size_t get_components() const { return datatype_traits<T>::size; }
    5656                virtual size_t get_count() const { return m_list.size(); }
    5757                virtual size_t get_size() const { return m_list.size() * sizeof(T); }
     
    6767                typedef std::unordered_map< std::string, vertex_attribute_base* > map;
    6868
    69                 mesh( primitive p = TRIANGLES, culling::order_type c = culling::CCW )
    70                         : m_map(), m_indices(), m_primitive( p ), m_order( c ) {}
     69                mesh( primitive p = TRIANGLES )
     70                        : m_map(), m_indices(), m_primitive( p ) {}
    7171                template <typename T>
    7272                vertex_attribute<T>* add_attribute( const string& attr )
     
    126126                vertex_attribute_base* m_indices;
    127127                primitive              m_primitive;
    128                 culling::order_type    m_order;
    129 
    130128        };
    131129
  • trunk/nv/interface/texture2d.hh

    r70 r121  
    6363                        m_size( size ), m_format( aformat ), m_datatype( adatatype ), m_sampler( asampler ) {}
    6464                virtual void assign( void* data ) = 0;
    65                 virtual void bind( int slot = 0 ) = 0;
     65                virtual void bind( size_t slot = 0 ) = 0;
    6666                virtual void unbind() = 0;
    6767                virtual bool is_valid() const = 0;
     
    7272                datatype get_datatype() const { return m_datatype; }
    7373                const sampler& get_sampler() const { return m_sampler; }
     74                virtual ~texture2d() {}
    7475        protected:
    7576                ivec2        m_size;
  • trunk/nv/interface/vertex_buffer.hh

    r119 r121  
    3232        {
    3333        public:
    34                 buffer( buffer_hint hint, int size ) { m_size = size; m_hint = hint; }
    35                 virtual void update( void* data, int offset, int size ) = 0;
     34                buffer( buffer_hint hint, size_t size ) { m_size = size; m_hint = hint; }
     35                virtual void update( void* data, size_t offset, size_t size ) = 0;
    3636                virtual void bind() = 0;
    3737                virtual void unbind() = 0;
    3838                virtual bool is_valid() const = 0;
    39                 int get_size() const { return m_size; };
    40                 buffer_hint get_hint() const { return m_hint; };
     39                size_t get_size() const { return m_size; }
     40                buffer_hint get_hint() const { return m_hint; }
    4141        virtual ~buffer() {}
    4242        protected:
    43                 int         m_size;
     43                size_t      m_size;
    4444                buffer_hint m_hint;
    4545        };
     
    4848        {
    4949        public:
    50                 vertex_buffer( buffer_hint hint, int size ) : buffer( hint, size ) {}
     50                vertex_buffer( buffer_hint hint, size_t size ) : buffer( hint, size ) {}
    5151        };
    5252
     
    5454        {
    5555        public:
    56                 index_buffer( buffer_hint hint, int size ) : buffer( hint, size ) {}
     56                index_buffer( buffer_hint hint, size_t size ) : buffer( hint, size ) {}
    5757        };
    5858
     
    6060        {
    6161        public:
    62                 vertex_buffer_attribute( vertex_buffer* buffer, datatype datatype, int components, int offset = 0, int stride = 0, bool owner = true )
     62                vertex_buffer_attribute( vertex_buffer* buffer, datatype datatype, size_t components, size_t offset = 0, size_t stride = 0, bool owner = true )
    6363                        : m_buffer( buffer ), m_datatype( datatype ), m_components( components ), m_offset( offset ), m_stride( stride ), m_owner( owner ) {}
    6464
     
    6666                void set_buffer( vertex_buffer* b, bool owner ) { if (m_owner) delete m_buffer; m_buffer = b; m_owner = owner; }
    6767                datatype get_datatype() const { return m_datatype; }
    68                 int get_components() const { return m_components; }
    69                 int get_offset() const { return m_offset; }
    70                 int get_stride() const { return m_stride; }
     68                size_t get_components() const { return m_components; }
     69                size_t get_offset() const { return m_offset; }
     70                size_t get_stride() const { return m_stride; }
    7171
    7272                ~vertex_buffer_attribute()
     
    8282                vertex_buffer* m_buffer;
    8383                datatype       m_datatype;
    84                 int  m_components;
    85                 int  m_offset;
    86                 int  m_stride;
    87                 bool m_owner;
     84                size_t  m_components;
     85                size_t  m_offset;
     86                size_t  m_stride;
     87                bool    m_owner;
    8888        };
    8989
     
    9494        public:
    9595                vertex_array() : m_map(), m_index( nullptr ), m_index_owner( false ), m_index_type(USHORT) {}
    96                 void add_vertex_buffer( int location, vertex_buffer* buffer, datatype datatype, int components, int offset = 0, int stride = 0, bool owner = true )
     96                void add_vertex_buffer( int location, vertex_buffer* buffer, datatype datatype, size_t components, size_t offset = 0, size_t stride = 0, bool owner = true )
    9797                {
    9898                        auto p = new vertex_buffer_attribute( buffer, datatype, components, offset, stride, owner );
    9999                        m_map[ location ] = p;
    100                 };
     100                }
    101101                void update_vertex_buffer( int location, vertex_buffer* b, bool owner )
    102102                {
     
    106106                                i->second->set_buffer( b, owner );
    107107                        }
    108                 };
     108                }
    109109                void set_index_buffer( index_buffer* buffer, datatype datatype, bool owner )
    110110                {
     
    123123                virtual void bind() = 0;
    124124                virtual void unbind() = 0;
    125                 ~vertex_array() {
     125                virtual ~vertex_array() {
    126126                        for ( vertex_buffer_attribute_map::iterator i = m_map.begin();  i != m_map.end(); ++i )
    127127                        {
  • trunk/nv/interface/window.hh

    r111 r121  
    3333                virtual void swap_buffers() = 0;
    3434                virtual device* get_device() = 0;
    35                 virtual ~window() {};
     35                virtual ~window() {}
    3636        };
    3737
  • trunk/nv/lib/lua.hh

    r5 r121  
    3232* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    3333******************************************************************************/
     34
     35#include <nv/common.hh>
    3436
    3537#define NV_LUA_DYNAMIC
  • trunk/nv/logger.hh

    r95 r121  
    4343                 * Enforcement of virtual destructor.
    4444                 */
    45                 virtual ~log_sink() {};
     45                virtual ~log_sink() {}
    4646        };
    4747
     
    6262                 * overriding cutoff.
    6363                 */
    64                 explicit logger( int llevel )
     64                explicit logger( unsigned int llevel )
    6565                {
    6666                        m_level = llevel;
  • trunk/nv/logging.hh

    r95 r121  
    1414#define NV_LOGGING_HH
    1515
     16#include <nv/common.hh>
    1617#include <nv/singleton.hh>
    1718#include <sstream>
     
    4041                {
    4142                        return m_level;
    42                 };
     43                }
    4344                void set_level( unsigned int level )
    4445                {
    4546                        m_level = level;
    46                 };
     47                }
    4748                virtual void log( log_level level, const std::string& message ) = 0;
     49                virtual ~logger_base() {}
    4850        protected:
    4951                unsigned int m_level;
  • trunk/nv/lua/lua_glm.hh

    r76 r121  
    99#include <new>
    1010#include <nv/common.hh>
    11 #include <glm/glm.hpp>
     11#include <nv/math.hh>
    1212#include <nv/lib/lua.hh>
    1313
     
    4141}
    4242
    43 template<> inline const char* nlua_metatable_name< glm::ivec2 >() { return "ivec2"; }
    44 template<> inline const char* nlua_metatable_name< glm::ivec3 >() { return "ivec3"; }
    45 template<> inline const char* nlua_metatable_name< glm::ivec4 >() { return "ivec4"; }
    46 template<> inline const char* nlua_metatable_name< glm::vec2  >() { return "vec2"; }
    47 template<> inline const char* nlua_metatable_name< glm::vec3  >() { return "vec3"; }
    48 template<> inline const char* nlua_metatable_name< glm::vec4  >() { return "vec4"; }
     43template<> inline const char* nlua_metatable_name< nv::ivec2 >() { return "ivec2"; }
     44template<> inline const char* nlua_metatable_name< nv::ivec3 >() { return "ivec3"; }
     45template<> inline const char* nlua_metatable_name< nv::ivec4 >() { return "ivec4"; }
     46template<> inline const char* nlua_metatable_name< nv::vec2  >() { return "vec2"; }
     47template<> inline const char* nlua_metatable_name< nv::vec3  >() { return "vec3"; }
     48template<> inline const char* nlua_metatable_name< nv::vec4  >() { return "vec4"; }
    4949
    5050#endif // NV_LUA_GLM_HH
  • trunk/nv/lua/lua_raw.hh

    r85 r121  
    77#define NV_LUA_RAW_HH
    88
     9#include <nv/common.hh>
    910#include <nv/lib/lua.hh>
    10 #include <nv/common.hh>
    1111#include <istream>
    1212#include <string>
  • trunk/nv/lua/lua_state.hh

    r86 r121  
    2929                {
    3030                public:
    31                         stack_guard( state* L );
    32                         stack_guard( state& L );
     31                        stack_guard( state* aL );
     32                        stack_guard( state& aL );
    3333                        int get_level() const { return m_level; }
    3434                        ~stack_guard();
  • trunk/nv/position.hh

    r120 r121  
    1414#define NV_POSITION_HH
    1515
    16 #include <glm/glm.hpp>
    1716#include <nv/common.hh>
     17#include <nv/math.hh>
    1818#include <utility>
    1919
    2020namespace nv
    2121{
    22         typedef glm::ivec2 position;
    23         typedef glm::ivec2 dimension;
     22        typedef ivec2 position;
     23        typedef ivec2 dimension;
    2424
    2525        struct rectangle
     
    4646                 *Creates a new rectangle given an upper-left and lower-right position.
    4747                 *
    48                  *@param ul The position of the upper-left corner of the rectangle.
    49                  *@param lr The position of the lower-right corner of the rectangle.
    50                  */
    51                 rectangle( position ul, position lr ) : ul(ul), lr(lr) {}
     48                 *@param aul The position of the upper-left corner of the rectangle.
     49                 *@param alr The position of the lower-right corner of the rectangle.
     50                 */
     51                rectangle( position aul, position alr ) : ul(aul), lr(alr) {}
    5252               
    5353                /**
    5454                 *Creates a new rectangle given an upper-left position, width, and height.
    5555                 *
    56                  *@param ul The position of the upper-left corner of the rectangle.
     56                 *@param aul The position of the upper-left corner of the rectangle.
    5757                 *@param width The width of the rectangle.
    5858                 *@param height The height of the rectangle.
    5959                 */
    60                 rectangle( position ul, value_type width, value_type height ) : ul(ul), lr(ul + position(width,height)) {}
     60                rectangle( position aul, value_type width, value_type height ) : ul(aul), lr(aul + position(width,height)) {}
    6161       
    6262        /**
     
    269269                {
    270270                        if (r.contains(*this)) return false;
    271                         ul = glm::max( ul, r.ul );
    272                         lr = glm::min( lr, r.lr );
    273                         ul = glm::min( ul, lr );
     271                        ul = nv::max( ul, r.ul );
     272                        lr = nv::min( lr, r.lr );
     273                        ul = nv::min( ul, lr );
    274274                        return true;
    275275                }
     
    284284                {
    285285                        if ( r.get_width() < get_width() || r.get_height() < get_height() ) return false;
    286                         (*this) += glm::min( r.ul - ul, position() );
    287                         (*this) -= glm::min( lr - r.lr, position() );
     286                        (*this) += nv::min( r.ul - ul, position() );
     287                        (*this) -= nv::min( lr - r.lr, position() );
    288288                        return true;
    289289                }
     
    305305                void include_point( position p )
    306306                {
    307                         lr = glm::max( lr, p );
    308                         ul = glm::min( ul, p );
     307                        lr = nv::max( lr, p );
     308                        ul = nv::min( ul, p );
    309309                }
    310310
  • trunk/nv/resource.hh

    r7 r121  
    3030                uid get_rid() const { return m_rid; }
    3131                uid get_size() const { return m_size; }
     32                virtual ~resource() {}
    3233        private:
    3334                uint32 m_size;
  • trunk/nv/time.hh

    r34 r121  
    2424         * @returns amount of ticks
    2525         */
    26         volatile uint64 get_ticks();
     26        uint64 get_ticks();
    2727
    2828        /**
    2929         * Performs an operating system sleep call.
    3030         *
    31          * @param time time in milliseconds to sleep
     31         * @param ms time in milliseconds to sleep
    3232         */
    3333        void sleep( uint32 ms );
  • trunk/nv/types.hh

    r113 r121  
    66#define NV_TYPES_HH
    77
    8 #include <glm/glm.hpp>
    98#include <nv/common.hh>
     9#include <nv/math.hh>
    1010#include <nv/object.hh>
    1111#include <type_traits>
     
    4444        };
    4545
    46         template <typename T>
    47         struct datatype_traits
    48         {
    49                 typedef T type;
    50                 typedef T base_type;
    51                 static const size_t size = 1;
    52         };
    53 
    54         template <typename T>
    55         struct datatype_traits< glm::detail::tvec2<T> >
    56         {
    57                 typedef glm::detail::tvec2<T> type;
    58                 typedef typename type::value_type base_type;
    59                 static const size_t size = 2;
    60         };
    61 
    62         template <typename T>
    63         struct datatype_traits< glm::detail::tvec3<T> >
    64         {
    65                 typedef glm::detail::tvec3<T> type;
    66                 typedef typename type::value_type base_type;
    67                 static const size_t size = 3;
    68         };
    69 
    70         template <typename T>
    71         struct datatype_traits< glm::detail::tvec4<T> >
    72         {
    73                 typedef glm::detail::tvec4<T> type;
    74                 typedef typename type::value_type base_type;
    75                 static const size_t size = 4;
    76         };
    77 
    78         typedef glm::detail::tvec2<sint8> i8vec2;
    79         typedef glm::detail::tvec3<sint8> i8vec3;
    80         typedef glm::detail::tvec4<sint8> i8vec4;
    81 
    82         typedef glm::vec2 vec2;
    83         typedef glm::vec3 vec3;
    84         typedef glm::vec4 vec4;
    85 
    86         typedef glm::ivec2 ivec2;
    87         typedef glm::ivec3 ivec3;
    88         typedef glm::ivec4 ivec4;
    89 
    90         typedef glm::mat2 mat2;
    91         typedef glm::mat3 mat3;
    92         typedef glm::mat4 mat4;
    93 
    9446        template < datatype EnumType > struct enum_to_type {};
    9547
     
    177129        enum type_flag
    178130        {
    179                 TF_POINTER      = 0x01, //< field is a pointer
    180                 TF_NOSERIALIZE  = 0x02, //< ignore during serialization
    181                 TF_INVISIBLE    = 0x04, //< field invisible to API
    182                 TF_READONLY     = 0x08, //< read only field
    183                 TF_SIMPLETYPE   = 0x10, //< raw binary I/O possible
     131                TF_POINTER      = 0x01, //!< field is a pointer
     132                TF_NOSERIALIZE  = 0x02, //!< ignore during serialization
     133                TF_INVISIBLE    = 0x04, //!< field invisible to API
     134                TF_READONLY     = 0x08, //!< read only field
     135                TF_SIMPLETYPE   = 0x10, //!< raw binary I/O possible
    184136                TF_OWNED        = 0x20,
    185                 TF_CONTAINER    = 0x40, //< is a container
     137                TF_CONTAINER    = 0x40, //!< is a container
    186138        };
    187139
    188140        struct type_field
    189141        {
    190                 std::string      name;      //< name of the field
    191                 std::string      type_name; //< name of the type of the field
    192                 const std::type_info* type_inf;  //< typeinfo for later retrieval of type
    193                 type_entry*      type;      //< pointer to field type
    194                 unsigned int     flags;     //< flags
     142                std::string      name;          //!< name of the field
     143                std::string      type_name;     //!< name of the type of the field
     144                const std::type_info* type_inf; //!< typeinfo for later retrieval of type
     145                type_entry*      type;          //!< pointer to field type
     146                unsigned int     flags;         //!< flags
    195147                size_t           offset;
    196148
    197149                template< typename TOBJECT, typename TFIELD >
    198                 type_field( const char* name, TFIELD TOBJECT::*field, typename std::enable_if< is_container<TFIELD>::value, void* >::type = nullptr )
    199                 : name(name)
     150                type_field( const char* aname, TFIELD TOBJECT::*field, typename std::enable_if< is_container<TFIELD>::value, void* >::type = nullptr )
     151                : name(aname)
    200152                        , type_name()
    201153                        , type_inf( &typeid( typename std::remove_pointer<typename TFIELD::value_type>::type ) )
     
    204156                        , offset( offset_of( field ) )
    205157                {
    206                         NV_LOG( LOG_INFO, name << "-" << offset);
     158                        NV_LOG( LOG_INFO, aname << "-" << offset);
    207159                        flags = TF_CONTAINER |
    208160                                ( std::is_pointer<typename TFIELD::value_type>::value ? TF_POINTER : 0 ) |
     
    211163
    212164                template< typename TOBJECT, typename TFIELD >
    213                 type_field( const char* name, TFIELD TOBJECT::*field, typename std::enable_if< !is_container<TFIELD>::value, void* >::type = nullptr )
    214                 : name(name)
     165                type_field( const char* aname, TFIELD TOBJECT::*field, typename std::enable_if< !is_container<TFIELD>::value, void* >::type = nullptr )
     166                : name(aname)
    215167                        , type_name()
    216168                        , type_inf( &typeid( typename std::remove_pointer<TFIELD>::type ) )
     
    219171                        , offset( offset_of( field ) )
    220172                {
    221                         NV_LOG( LOG_INFO, name << "-" << offset);
     173                        NV_LOG( LOG_INFO, aname << "-" << offset);
    222174                        flags =
    223175                                ( std::is_pointer<TFIELD>::value ? TF_POINTER : 0 ) |
     
    236188                std::string name;
    237189                int         value;
    238                 type_enum( const char* name, int value ) : name(name), value(value) {}
     190                type_enum( const char* aname, int avalue ) : name(aname), value(avalue) {}
    239191        };
    240192
     
    345297    {
    346298        base_type = type_db->get_type( typeid(TYPE) );
     299                return *this;
    347300    }
    348301   
  • trunk/src/gfx/image.cc

    r90 r121  
    1212        : m_size( size ), m_depth( depth ), m_data( nullptr )
    1313{
    14         m_data = new uint8[ m_size.x * m_size.y * m_depth ];
     14        m_data = new uint8[ static_cast<uint16>( m_size.x * m_size.y ) * m_depth ];
    1515}
    1616
     
    2525        : m_size( size ), m_depth( depth ), m_data( nullptr )
    2626{
    27         std::size_t bsize = m_size.x * m_size.y * m_depth;
    28         m_data = new uint8[ m_size.x * m_size.y * m_depth ];
     27        sint32 bsize = m_size.x * m_size.y * static_cast<sint32>( m_depth );
     28        m_data = new uint8[ bsize ];
    2929
    3030        if ( reversed )
    3131        {
    32                 std::size_t bline = m_size.x * m_depth;
     32                sint32 bline = m_size.x * static_cast<sint32>( m_depth );
    3333                for( int i = 0; i < m_size.y; ++i )
    3434                {
     
    4545void image::fill( uint8 value )
    4646{
    47         std::fill( m_data, m_data + m_size.x * m_size.y * m_depth, value );
     47        std::fill( m_data, m_data + m_size.x * m_size.y * (int)m_depth, value );
    4848}
    4949
    50 void image::set_region( region r, const uint8 * data, size_t stride )
     50void image::set_region( region r, const uint8 * data, int stride )
    5151{
    52         if ( stride == 0 ) stride = r.size.x * m_depth;
     52        if ( stride == 0 ) stride = r.size.x * static_cast<sint32>( m_depth );
    5353       
    54         std::size_t bpos  = (r.pos.y*m_size.x + r.pos.x ) * m_depth;
    55         std::size_t bline = m_size.x*m_depth;
     54        sint32 bpos  = (r.pos.y*m_size.x + r.pos.x ) * static_cast<sint32>( m_depth );
     55        sint32 bline = m_size.x*static_cast<sint32>( m_depth );
    5656
    5757        for( int i = 0; i < r.size.y; ++i )
  • trunk/src/gfx/texture_atlas.cc

    r89 r121  
    3737                        {
    3838                                best_height = y + size.y;
    39                                 best_index = i;
     39                                best_index = static_cast<int>( i );
    4040                                best_width = node.z;
    4141                                r.pos.x = node.x;
     
    5252        m_nodes.insert( m_nodes.begin() + best_index, glm::ivec3( r.pos.x, r.pos.y + size.y, size.x ) );
    5353
    54         for( size_t i = best_index+1; i < m_nodes.size(); ++i )
     54        for( size_t i = static_cast<size_t>( best_index )+1; i < m_nodes.size(); ++i )
    5555        {
    5656                glm::ivec3 node = m_nodes[ i ];
     
    6565                        if (m_nodes[ i ].z <= 0)
    6666                        {
    67                                 m_nodes.erase( m_nodes.begin() + i );
     67                                m_nodes.erase( m_nodes.begin() + static_cast<int>(i) );
    6868                                --i;
    6969                        }
     
    7979        }
    8080        merge();
    81         m_used += size.x * size.y;
     81        m_used += static_cast<uint16>(size.x * size.y);
    8282        return r;
    8383}
     
    119119                {
    120120                        m_nodes[ i ].z += m_nodes[ i+1 ].z;
    121             m_nodes.erase( m_nodes.begin()+i+1 );
     121            m_nodes.erase( m_nodes.begin()+static_cast<int>(i+1) );
    122122                        --i;
    123123                }
  • trunk/src/gfx/texture_font.cc

    r114 r121  
    1717}
    1818
    19 float texture_glyph::get_kerning( const uint16 charcode )
     19float texture_glyph::get_kerning( const uint16 other )
    2020{
    21         auto i = kerning.find( charcode );
     21        auto i = kerning.find( other );
    2222        return i != kerning.end() ? i->second : 0.0f;
    2323}
     
    118118        }
    119119
    120         for ( char c : codes )
     120        for ( char ch : codes )
    121121        {
     122                uint16 c = static_cast<uint16>( ch );
    122123                FT_UInt glyph_index = FT_Get_Char_Index( face, c );
    123124                FT_Error error = FT_Load_Glyph( face, glyph_index, flags );
     
    136137                int ft_glyph_top    = slot->bitmap_top;
    137138                int ft_glyph_left   = slot->bitmap_left;
    138                 int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : depth);
     139                int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : (int)depth);
    139140
    140141                glm::ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 );
  • trunk/src/gl/gl_context.cc

    r116 r121  
    8383}
    8484
    85 void gl_context::apply_stencil_face( int face, stencil_test_face& stencil, const stencil_test_face& new_stencil )
     85void gl_context::apply_stencil_face( unsigned face, stencil_test_face& stencil, const stencil_test_face& new_stencil )
    8686{
    8787        if (( stencil.op_fail       != new_stencil.op_fail       ) ||
     
    317317}
    318318
    319 void gl_context::force_apply_stencil_face( int face, const stencil_test_face& stencil )
     319void gl_context::force_apply_stencil_face( unsigned face, const stencil_test_face& stencil )
    320320{
    321321        glStencilOpSeparate( face,
     
    356356}
    357357
    358 void gl_context::draw( primitive prim, const render_state& rs, program* p, vertex_array* va, int count )
     358void gl_context::draw( primitive prim, const render_state& rs, program* p, vertex_array* va, size_t count )
    359359{
    360360        apply_render_state( rs );
     
    365365                if ( va->has_index_buffer() )
    366366                {
    367                         glDrawElements( primitive_to_enum(prim), count, datatype_to_gl_enum( va->get_index_buffer_type() ), 0 );
     367                        glDrawElements( primitive_to_enum(prim), static_cast<GLsizei>( count ), datatype_to_gl_enum( va->get_index_buffer_type() ), 0 );
    368368                }
    369369                else
    370370                {
    371                         glDrawArrays( primitive_to_enum(prim), 0, count);
     371                        glDrawArrays( primitive_to_enum(prim), 0, static_cast<GLsizei>( count ) );
    372372                }
    373373                va->unbind();
  • trunk/src/gl/gl_device.cc

    r120 r121  
    5353}
    5454
    55 vertex_buffer* gl_device::create_vertex_buffer( buffer_hint hint, int size, void* source /*= nullptr */ )
     55vertex_buffer* gl_device::create_vertex_buffer( buffer_hint hint, size_t size, void* source /*= nullptr */ )
    5656{
    5757        return new gl_vertex_buffer( hint, size, source );
    5858}
    5959
    60 index_buffer* gl_device::create_index_buffer( buffer_hint hint, int size, void* source /*= nullptr */ )
     60index_buffer* gl_device::create_index_buffer( buffer_hint hint, size_t size, void* source /*= nullptr */ )
    6161{
    6262        return new gl_index_buffer( hint, size, source );
  • trunk/src/gl/gl_enum.cc

    r70 r121  
    3030        case depth_test::GREATER_OR_EQUAL : return GL_GEQUAL;
    3131        case depth_test::ALWAYS           : return GL_ALWAYS;
    32         default : return 0; // TODO: throw!
     32        NV_RETURN_COVERED_DEFAULT( 0 );
    3333        }
    3434}
     
    5353        case blending::ONE_MINUS_CONSTANT_ALPHA: return GL_ONE_MINUS_CONSTANT_ALPHA;
    5454        case blending::SRC_ALPHA_SATURATE      : return GL_SRC_ALPHA_SATURATE;
    55         default : return 0; // TODO: throw!
     55        NV_RETURN_COVERED_DEFAULT( 0 );
    5656        }
    5757}
     
    6666        case blending::MINIMUM          : return GL_MIN;
    6767        case blending::MAXIMUM          : return GL_MAX;
    68         default : return 0; // TODO: throw!
     68        NV_RETURN_COVERED_DEFAULT( 0 );
    6969        }
    7070}
     
    7777        case culling::BACK           : return GL_BACK;
    7878        case culling::FRONT_AND_BACK : return GL_FRONT_AND_BACK;
    79         default : return 0; // TODO: throw!
     79        NV_RETURN_COVERED_DEFAULT( 0 );
    8080        }
    8181}
     
    8787        case culling::CW   : return GL_CW;
    8888        case culling::CCW  : return GL_CCW;
    89         default : return 0; // TODO: throw!
     89        NV_RETURN_COVERED_DEFAULT( 0 );
    9090        }
    9191}
     
    103103        case stencil_test_face::GREATER_OR_EQUAL : return GL_GEQUAL;
    104104        case stencil_test_face::ALWAYS           : return GL_ALWAYS;
    105         default : return 0; // TODO: throw!
     105        NV_RETURN_COVERED_DEFAULT( 0 );
    106106        }
    107107}
     
    119119        case stencil_test_face::INCREMENT_WRAP   : return GL_INCR_WRAP;
    120120        case stencil_test_face::DECREMENT_WRAP   : return GL_DECR_WRAP;
    121         default : return 0; // TODO: throw!
     121        NV_RETURN_COVERED_DEFAULT( 0 );
    122122        }
    123123}
     
    130130        case STREAM_DRAW   : return GL_STREAM_DRAW;
    131131        case DYNAMIC_DRAW  : return GL_DYNAMIC_DRAW;
    132         default : return 0; // TODO: throw!
     132        NV_RETURN_COVERED_DEFAULT( 0 );
    133133        }
    134134}
     
    140140        case RGB  : return GL_RGB;
    141141        case RGBA : return GL_RGBA;
    142         default : return 0; // TODO: throw!
     142        NV_RETURN_COVERED_DEFAULT( 0 );
    143143        }
    144144}
     
    154154        case sampler::NEAREST_MIPMAP_LINEAR  : return GL_NEAREST_MIPMAP_LINEAR;
    155155        case sampler::LINEAR_MIPMAP_LINEAR   : return GL_LINEAR_MIPMAP_LINEAR;
    156         default : return 0; // TODO: throw!
     156        NV_RETURN_COVERED_DEFAULT( 0 );
    157157        }
    158158}
     
    166166        case sampler::MIRRORED_REPEAT : return GL_MIRRORED_REPEAT;
    167167        case sampler::REPEAT          : return GL_REPEAT;
    168         default : return 0; // TODO: throw!
     168        NV_RETURN_COVERED_DEFAULT( 0 );
    169169        }
    170170}
     
    181181        case TRIANGLE_STRIP : return GL_TRIANGLE_STRIP;
    182182        case TRIANGLE_FAN   : return GL_TRIANGLE_FAN;
    183         default : return 0; // TODO: throw!
     183        NV_RETURN_COVERED_DEFAULT( 0 );
    184184        }
    185185}
     
    209209        case BYTE_VECTOR_3  : return GL_INT_VEC3;
    210210        case BYTE_VECTOR_4  : return GL_INT_VEC4;
    211         default : return 0; // TODO: throw!
     211        NV_RETURN_COVERED_DEFAULT( 0 );
    212212        }
    213213}
  • trunk/src/gl/gl_program.cc

    r70 r121  
    1414using namespace nv;
    1515
    16 gl_shader::gl_shader( uint32 shader_type )
    17         : object_id(0), shader_type( shader_type )
     16gl_shader::gl_shader( uint32 sh_type )
     17        : shader_type( sh_type ), object_id(0)
    1818{
    1919        // no op
    2020}
    2121
    22 gl_shader::gl_shader( uint32 shader_type, const string& shader_code )
    23         : object_id(0), shader_type( shader_type )
     22gl_shader::gl_shader( uint32 sh_type, const string& shader_code )
     23        : shader_type( sh_type ), object_id(0)
    2424{
    2525        compile( shader_code );
     
    140140        glGetProgramiv( m_name.get_value(), GL_ACTIVE_ATTRIBUTES, &params );
    141141
    142         for ( int i = 0; i < params; ++i )
     142        for ( unsigned i = 0; i < (unsigned)params; ++i )
    143143        {
    144144                int attr_nlen;
     
    149149                glGetActiveAttrib( m_name.get_value(), i, 128, &attr_nlen, &attr_len, &attr_type, name_buffer );
    150150
    151                 string name( name_buffer, attr_nlen );
     151                string name( name_buffer, size_t(attr_nlen) );
    152152
    153153                // skip built-ins
     
    165165        glGetProgramiv( m_name.get_value(), GL_ACTIVE_UNIFORMS, &params );
    166166
    167         for ( int i = 0; i < params; ++i )
     167        for ( unsigned i = 0; i < size_t(params); ++i )
    168168        {
    169169                int uni_nlen;
     
    174174                glGetActiveUniform( m_name.get_value(), i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer );
    175175
    176                 string name( name_buffer, uni_nlen );
     176                string name( name_buffer, size_t(uni_nlen) );
    177177
    178178                // skip built-ins
     
    206206                        case FLOAT_MATRIX_3 : glUniformMatrix3fv( uloc, 1, GL_FALSE, glm::value_ptr(((uniform< enum_to_type< FLOAT_MATRIX_3 >::type >*)( ubase ))->get_value()) ); break;
    207207                        case FLOAT_MATRIX_4 : glUniformMatrix4fv( uloc, 1, GL_FALSE, glm::value_ptr(((uniform< enum_to_type< FLOAT_MATRIX_4 >::type >*)( ubase ))->get_value()) ); break;
    208                         //default     : error?
     208                        default : break; // error?
    209209                        }
    210210                        ubase->clean();
  • trunk/src/gl/gl_texture2d.cc

    r70 r121  
    1515        glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
    1616
    17         glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nv::sampler_filter_to_enum( m_sampler.filter_min ) );
    18         glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nv::sampler_filter_to_enum( m_sampler.filter_max ) );
    19         glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, nv::sampler_wrap_to_enum( m_sampler.wrap_s) );
    20         glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, nv::sampler_wrap_to_enum( m_sampler.wrap_t) );
     17        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (int)nv::sampler_filter_to_enum( m_sampler.filter_min ) );
     18        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (int)nv::sampler_filter_to_enum( m_sampler.filter_max ) );
     19        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_s) );
     20        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_t) );
    2121
    2222        glBindTexture( GL_TEXTURE_2D, 0 );
     
    3131{
    3232        glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
    33         glTexImage2D( GL_TEXTURE_2D, 0, nv::image_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::datatype_to_gl_enum(m_datatype), data );
     33        glTexImage2D( GL_TEXTURE_2D, 0, (GLint)nv::image_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::datatype_to_gl_enum(m_datatype), data );
    3434        glBindTexture( GL_TEXTURE_2D, 0 );
    3535}
    3636
    37 void nv::gl_texture2d::bind( int slot )
     37void nv::gl_texture2d::bind( size_t slot )
    3838{
    3939        glActiveTexture( GL_TEXTURE0 + slot );
  • trunk/src/gl/gl_vertex_buffer.cc

    r116 r121  
    1010using namespace nv;
    1111
    12 gl_vertex_buffer::gl_vertex_buffer( buffer_hint hint, int size, void* data )
     12gl_vertex_buffer::gl_vertex_buffer( buffer_hint hint, size_t size, void* data )
    1313        : vertex_buffer( hint, size ), m_name()
    1414{
    1515        bind();
    16         glBufferData( GL_ARRAY_BUFFER, m_size, data, buffer_hint_to_enum( m_hint ) );
     16        glBufferData( GL_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) );
    1717        unbind();
    1818}
    1919
    20 void gl_vertex_buffer::update( void* data, int offset, int size )
     20void gl_vertex_buffer::update( void* data, size_t offset, size_t size )
    2121{
    22         glBufferSubData( GL_ARRAY_BUFFER, offset, size, data );
     22        glBufferSubData( GL_ARRAY_BUFFER, (GLintptr)offset, (GLsizeiptr)size, data );
    2323}
    2424
     
    3939}
    4040
    41 gl_index_buffer::gl_index_buffer( buffer_hint hint, int size, void* data )
     41gl_index_buffer::gl_index_buffer( buffer_hint hint, size_t size, void* data )
    4242        : index_buffer( hint, size ), m_name()
    4343{
    4444        bind();
    45         glBufferData( GL_ELEMENT_ARRAY_BUFFER, m_size, data, buffer_hint_to_enum( m_hint ) );
     45        glBufferData( GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) );
    4646        unbind();
    4747}
    4848
    49 void gl_index_buffer::update( void* data, int offset, int size )
     49void gl_index_buffer::update( void* data, size_t offset, size_t size )
    5050{
    51         glBufferSubData( GL_ELEMENT_ARRAY_BUFFER, offset, size, data );
     51        glBufferSubData( GL_ELEMENT_ARRAY_BUFFER, (GLintptr)offset, (GLsizeiptr)size, data );
    5252}
    5353
     
    7676        for ( vertex_buffer_attribute_map::iterator i = m_map.begin();  i != m_map.end(); ++i )
    7777        {
    78                 int location                = i->first;
     78                uint32 location             = static_cast<uint32>( i->first );
    7979                vertex_buffer_attribute* va = i->second;
    8080                vertex_buffer*           vb = va->get_buffer();
     
    8383                glVertexAttribPointer(
    8484                        location,
    85                         va->get_components(),
     85                        static_cast<GLint>( va->get_components() ),
    8686                        nv::datatype_to_gl_enum( va->get_datatype() ),
    8787                        GL_FALSE,
    88                         va->get_stride(),
     88                        static_cast<GLsizei>( va->get_stride() ),
    8989                        (void*)va->get_offset()
    9090                        );
     
    107107        for ( vertex_buffer_attribute_map::iterator i = m_map.begin();  i != m_map.end(); ++i )
    108108        {
    109                 glDisableVertexAttribArray( i->first );
     109                glDisableVertexAttribArray( static_cast<uint32>( i->first ) );
    110110        }
    111111}
  • trunk/src/gl/gl_window.cc

    r98 r121  
    2121        if (ke.keysym.unicode >= 32 && ke.keysym.unicode < 128 )
    2222        {
    23                 kevent.key.ascii = (char)ke.keysym.unicode;
     23                kevent.key.ascii = static_cast<char8>( ke.keysym.unicode );
    2424        }
    2525
     
    151151        : m_device( dev ), m_width( width ), m_height( height ), m_title("NV Engine"), m_screen( nullptr )
    152152{
    153         int flags = SDL_OPENGL;
     153        uint32 flags = SDL_OPENGL;
    154154       
    155155        m_screen = SDL_SetVideoMode( width, height, 32, flags );
  • trunk/src/gui/gui_style.cc

    r114 r121  
    3636        for (size_t i = 0; i < 4; ++i )
    3737        {
    38                 lua_rawgeti( m_lua, -1, i+1 );
     38                lua_rawgeti( m_lua, -1, static_cast<int>( i+1 ) );
    3939                if ( lua_isnil( m_lua, -1 ) ) return true;
    4040                vec[i] = (float)lua_tonumber( m_lua, -1 );
  • trunk/src/io_event.cc

    r78 r121  
    99using namespace nv;
    1010
    11 const char* get_key_name( key_code key )
     11const char* nv::get_key_name( key_code key )
    1212{
    1313        switch ( key )
     
    1616#               include <nv/detail/key_list.inc>
    1717#       undef NV_KEY
    18 default: return "KEY_UNKNOWN";
     18        NV_RETURN_COVERED_DEFAULT( "KEY_UNKNOWN" );
    1919        };
    2020}
    2121
    22 const char* get_mouse_name( mouse_code button )
     22const char* nv::get_mouse_name( mouse_code button )
    2323{
    2424        switch ( button )
     
    2727#               include <nv/detail/mouse_list.inc>
    2828#       undef NV_MOUSE
    29 default: return "MOUSE_UNKNOWN";
     29        NV_RETURN_COVERED_DEFAULT( "MOUSE_UNKNOWN" );
    3030        };
    3131}
    3232
    33 const char* get_io_event_name( io_event_code event )
     33const char* nv::get_io_event_name( io_event_code event )
    3434{
    3535        switch ( event )
     
    3838#               include <nv/detail/io_event_list.inc>
    3939#       undef NV_IO_EVENT
    40 default: return "EV_UNKNOWN";
     40        NV_RETURN_COVERED_DEFAULT( "EV_UNKNOWN" );
    4141        };
    4242}
    4343
    44 void register_io_types( type_database* db )
     44void nv::register_io_types( type_database* db )
    4545{
    4646        type_enum key_enums[] = {
  • trunk/src/library.cc

    r120 r121  
    3737
    3838library::library()
    39     : m_name(), m_handle( nullptr )
     39    : m_handle( nullptr ), m_name()
    4040{
    4141}
  • trunk/src/logger.cc

    r64 r121  
    2121
    2222// log level names
    23 const char *log_level_names[] =
     23static const char *log_level_names[] =
    2424{
    2525        "NONE",
     
    3737
    3838// log level names
    39 const char *log_level_names_pad[] =
     39static const char *log_level_names_pad[] =
    4040{
    4141        "NONE    ",
     
    5757
    5858#if NV_PLATFORM == NV_WINDOWS
    59 unsigned short log_color[] =
     59static unsigned short log_color[] =
    6060{
    6161        FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
     
    7272};
    7373#else
    74 const char *log_color[] =
     74static const char *log_color[] =
    7575{
    7676        "\33[37;1m",
  • trunk/src/lua/lua_glm.cc

    r113 r121  
    1212static size_t nlua_swizzel_lookup[256];
    1313
    14 inline bool nlua_is_swizzel( const char* str, size_t max )
     14inline bool nlua_is_swizzel( const unsigned char* str, size_t max )
    1515{
    1616        while (*str)
     
    2424template < typename T, size_t k >
    2525struct nlua_vec_constructor {
    26         static inline T construct( lua_State* L, int index ) {
     26        static inline T construct( lua_State*, int ) {
    2727                return T();
    2828        }
     
    202202        size_t len  = 0;
    203203        size_t vlen = v->length();
    204         const char * key = lua_tolstring( L, 2, &len );
     204        const unsigned char * key = (const unsigned char *)( lua_tolstring( L, 2, &len ) );
    205205        size_t idx = 255;
    206206
     
    240240        size_t len  = 0;
    241241        size_t vlen = v->length();
    242         const char * key = lua_tolstring( L, 2, &len );
     242        const unsigned char * key = (const unsigned char *)( lua_tolstring( L, 2, &len ) );
    243243        size_t idx = 255;
    244244        if( len == 1 )
     
    321321{
    322322        for (size_t i = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255;
    323         nlua_swizzel_lookup['x'] = 0;
    324         nlua_swizzel_lookup['r'] = 0;
    325         nlua_swizzel_lookup['s'] = 0;
    326         nlua_swizzel_lookup['0'] = 0;
    327         nlua_swizzel_lookup['y'] = 1;
    328         nlua_swizzel_lookup['g'] = 1;
    329         nlua_swizzel_lookup['t'] = 0;
    330         nlua_swizzel_lookup['1'] = 1;
    331         nlua_swizzel_lookup['z'] = 2;
    332         nlua_swizzel_lookup['b'] = 2;
    333         nlua_swizzel_lookup['u'] = 0;
    334         nlua_swizzel_lookup['2'] = 2;
    335         nlua_swizzel_lookup['w'] = 3;
    336         nlua_swizzel_lookup['a'] = 3;
    337         nlua_swizzel_lookup['v'] = 0;
    338         nlua_swizzel_lookup['3'] = 3;
     323        using nv::char8;
     324        nlua_swizzel_lookup[char8( 'x' )] = 0;
     325        nlua_swizzel_lookup[char8( 'r' )] = 0;
     326        nlua_swizzel_lookup[char8( 's' )] = 0;
     327        nlua_swizzel_lookup[char8( '0' )] = 0;
     328        nlua_swizzel_lookup[char8( 'y' )] = 1;
     329        nlua_swizzel_lookup[char8( 'g' )] = 1;
     330        nlua_swizzel_lookup[char8( 't' )] = 0;
     331        nlua_swizzel_lookup[char8( '1' )] = 1;
     332        nlua_swizzel_lookup[char8( 'z' )] = 2;
     333        nlua_swizzel_lookup[char8( 'b' )] = 2;
     334        nlua_swizzel_lookup[char8( 'u' )] = 0;
     335        nlua_swizzel_lookup[char8( '2' )] = 2;
     336        nlua_swizzel_lookup[char8( 'w' )] = 3;
     337        nlua_swizzel_lookup[char8( 'a' )] = 3;
     338        nlua_swizzel_lookup[char8( 'v' )] = 0;
     339        nlua_swizzel_lookup[char8( '3' )] = 3;
    339340        int stack = lua_gettop( L );
    340341
    341         luaL_requiref(L, "ivec2", luaopen_vec<glm::ivec2>, 1);
    342         luaL_requiref(L, "ivec3", luaopen_vec<glm::ivec3>, 1);
    343         luaL_requiref(L, "ivec4", luaopen_vec<glm::ivec4>, 1);
    344         luaL_requiref(L, "vec2", luaopen_vec<glm::vec2>, 1);
    345         luaL_requiref(L, "vec3", luaopen_vec<glm::vec3>, 1);
    346         luaL_requiref(L, "vec4", luaopen_vec<glm::vec4>, 1);
     342        luaL_requiref(L, "ivec2", luaopen_vec<nv::ivec2>, 1);
     343        luaL_requiref(L, "ivec3", luaopen_vec<nv::ivec3>, 1);
     344        luaL_requiref(L, "ivec4", luaopen_vec<nv::ivec4>, 1);
     345        luaL_requiref(L, "vec2", luaopen_vec<nv::vec2>, 1);
     346        luaL_requiref(L, "vec3", luaopen_vec<nv::vec3>, 1);
     347        luaL_requiref(L, "vec4", luaopen_vec<nv::vec4>, 1);
    347348        lua_settop( L, stack );
    348349}
  • trunk/src/lua/lua_raw.cc

    r85 r121  
    3030{
    3131        index = lua_absindex( L, index );
    32         int len = lua_rawlen( L, index );
     32        int len = static_cast<int>( lua_rawlen( L, index ) );
    3333        int i   = len;
    3434        lua_createtable( L, len, 0 );
  • trunk/src/lua/lua_state.cc

    r86 r121  
    1515using namespace nv;
    1616
    17 lua::stack_guard::stack_guard( lua::state* L )
    18         : L(L), m_level( lua_gettop(L->L) )
    19 {
    20 
    21 }
    22 
    23 lua::stack_guard::stack_guard( lua::state& L )
    24         : L(&L), m_level( lua_gettop((&L)->L) )
     17lua::stack_guard::stack_guard( lua::state* aL )
     18        : L(aL), m_level( lua_gettop(aL->L) )
     19{
     20
     21}
     22
     23lua::stack_guard::stack_guard( lua::state& aL )
     24        : L(&aL), m_level( lua_gettop(aL.L) )
    2525{
    2626
  • trunk/src/time.cc

    r34 r121  
    4242static timer_impl zero_timer;
    4343
    44 volatile nv::uint64 nv::get_ticks()
     44nv::uint64 nv::get_ticks()
    4545{
    4646#if NV_COMPILER == NV_MSVC
    4747        return __rdtsc();
    48 #elif NV_COMPILER == NV_GNUC
    49         register long long ticks asm("eax");
     48#else
     49        register long long ticks asm("eax") = 0;
    5050        asm volatile (".byte 15, 49" : : : "eax", "edx");
    51         return ticks;
    52 #else
    53         return 0; // unsupported
     51        return static_cast<nv::uint64>( ticks );
    5452#endif
    5553}
     
    5957#if NV_COMPILER == NV_MSVC
    6058        Sleep( ms );
    61 #elif NV_COMPILER == NV_GNUC
     59#else
    6260        usleep( ms * 1000 );
    63 #else
    6461#endif
    6562}
     
    8582        struct timeval now;
    8683        gettimeofday(&now, NULL);
    87         return (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000+(now.tv_usec-zero_timer.timeval_zero.tv_usec)/1000;
     84        return (uint32)( (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000+(now.tv_usec-zero_timer.timeval_zero.tv_usec)/1000 );
    8885#endif
    8986}
     
    9996        struct timeval now;
    10097        gettimeofday(&now, NULL);
    101         return (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000000+(now.tv_usec - zero_timer.timeval_zero.tv_usec);
     98        return (uint32)( (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000000+(now.tv_usec - zero_timer.timeval_zero.tv_usec) );
    10299#endif
    103100}
  • trunk/tests/render_test/rl.cc

    r93 r121  
    88#include <nv/logging.hh>
    99#include <nv/logger.hh>
    10 #include <glm/glm.hpp>
    11 #include <glm/gtc/matrix_transform.hpp>
    12 #include <glm/gtc/type_ptr.hpp>
     10#include <nv/math.hh>
    1311#include <nv/string.hh>
    1412#include <nv/types.hh>
     
    1917const nv::uint16 size_xy = size_x * size_y;
    2018
    21 nv::uint8 height[size_xy] =
     19static nv::uint8 height[size_xy] =
    2220{
    2321        4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,
     
    3937};
    4038
    41 nv::uint8 map[size_xy] =
     39static nv::uint8 map[size_xy] =
    4240{
    4341        2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
     
    224222                                        case nv::KEY_UP     : move.z = move.z - 1.0f; break;
    225223                                        case nv::KEY_DOWN   : move.z = move.z + 1.0f; break;
     224                                        default: break;
    226225                                        }
    227226                                }
    228227                                break;
     228                        default: break;
    229229                        }
    230230                }
Note: See TracChangeset for help on using the changeset viewer.