Changeset 550 for trunk


Ignore:
Timestamp:
03/09/17 13:33:03 (8 years ago)
Author:
epyon
Message:
  • ECS and windowing updates
Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/ecs/component.hh

    r545 r550  
    5959
    6060                        component( ecs_type& a_ecs, string_view a_name, bool relational = false, uint32 reserve = 0 )
    61                                 : m_ecs( a_ecs ), m_relational( relational )
    62                         {
     61                                : m_ecs( a_ecs ), m_relational( relational ), m_storage( nullptr )
     62                        {
     63                                m_storage = new storage_type;
    6364                                m_ecs.register_component<component_type, Handler>( a_name, this );
    64 
    6565                                if ( reserve != 0 )
    6666                                {
    67                                         m_data.reserve( reserve );
    68                                 }
    69                         }
    70 
    71                         virtual void initialize( handle_type, lua::stack_proxy& ) {};
     67                                        m_storage->reserve( reserve );
     68                                }
     69                        }
     70
     71                        virtual uint32 temp_index( handle_type h ) const  final
     72                        {
     73                                return m_index.get( h );
     74                        }
     75
    7276
    7377                        inline value_type& insert( handle_type h )
    7478                        {
    7579                                index_type i = m_index.insert( h );
    76                                 NV_ASSERT( i == index_type( m_data.size() ), "Fail!" );
     80                                NV_ASSERT( i == index_type( m_storage->size() ), "Fail!" );
    7781                                NV_UNUSED( i );
    78                                 m_data.emplace_back();
    79                                 return m_data.back();
     82                                m_storage->emplace_back();
     83                                return m_storage->back();
    8084                        }
    8185
     
    8488                        {
    8589                                index_type i = m_index.insert( h );
    86                                 NV_ASSERT( i == index_type( m_data.size() ), "Fail!" );
     90                                NV_ASSERT( i == index_type( m_storage->size() ), "Fail!" );
    8791                                NV_UNUSED( i );
    88                                 m_data.emplace_back( nv::forward<Args>( args )... );
    89                                 return m_data.back();
    90                         }
     92                                m_storage->emplace_back( nv::forward<Args>( args )... );
     93                                return m_storage->back();
     94                        }
     95
     96                        virtual void* insert_raw( handle_type h ) final
     97                        {
     98                                return &insert( h );
     99                        }
     100
    91101
    92102                        bool exists( handle_type h )
     
    95105                        }
    96106
    97                         virtual void update( time_type /*dtime*/ )
    98                         {
    99                                 // no-op
    100                         }
    101 
    102                         virtual void clear()
    103                         {
    104                                 for ( uint32 i = 0; i < m_data.size(); ++i )
    105                                         destroy( &m_data[i] );
     107                        void call_destroy( value_type* data )
     108                        {
     109                                for ( auto dh : m_destroy )
     110                                        dh( data );
     111                        }
     112
     113                        virtual void clear_() final
     114                        {
     115                                for ( uint32 i = 0; i < m_storage->size(); ++i )
     116                                        call_destroy( &(*m_storage)[i] );
    106117                                m_index.clear();
    107                                 m_data.clear();
     118                                m_storage->clear();
    108119                        }
    109120
     
    111122                        {
    112123                                index_type i = m_index.get( h );
    113                                 return i >= 0 ? &( m_data[unsigned( i )] ) : nullptr;
     124                                return i >= 0 ? &( ( *m_storage )[unsigned( i )] ) : nullptr;
    114125                        }
    115126                        const value_type* get( handle_type h ) const
    116127                        {
    117128                                index_type i = m_index.get( h );
    118                                 return i >= 0 ? &( m_data[unsigned( i )] ) : nullptr;
     129                                return i >= 0 ? &( ( *m_storage )[unsigned( i )] ) : nullptr;
    119130                        }
    120131
     
    122133                        const void* get_raw( handle_type h ) const { return get( h ); }
    123134
    124                         virtual void remove( handle_type h ) override
     135                        virtual void remove( handle_type h ) final
    125136                        {
    126137                                value_type* v = get( h );
    127138                                if ( v == nullptr ) return;
    128                                 destroy( v );
     139                                call_destroy( v );
    129140                                index_type dead_eindex = m_index.remove_swap( h );
    130141                                if ( dead_eindex == -1 ) return;
    131                                 if ( dead_eindex != static_cast<index_type>( m_data.size() - 1 ) )
    132                                 {
    133                                         m_data[unsigned( dead_eindex )] = move( m_data.back() );
    134                                 }
    135                                 m_data.pop_back();
     142                                if ( dead_eindex != static_cast<index_type>( m_storage->size() - 1 ) )
     143                                {
     144                                        ( *m_storage )[unsigned( dead_eindex )] = move( m_storage->back() );
     145                                }
     146                                m_storage->pop_back();
    136147                                if ( m_relational )
    137148                                        relational_rebuild( dead_eindex );
     
    141152                        {
    142153                                if ( i > size() ) return;
    143                                 destroy( &m_data[i] );
     154                                call_destroy( &(*m_storage)[i] );
    144155                                index_type dead_eindex = m_index.remove_swap_by_index( i );
    145156                                if ( dead_eindex == -1 ) return;
    146                                 if ( dead_eindex != static_cast<index_type>( m_data.size() - 1 ) )
    147                                 {
    148                                         m_data[unsigned( dead_eindex )] = move( m_data.back() );
    149                                 }
    150                                 m_data.pop_back();
     157                                if ( dead_eindex != static_cast<index_type>( m_storage->size() - 1 ) )
     158                                {
     159                                        ( *m_storage )[unsigned( dead_eindex )] = move( m_storage->back() );
     160                                }
     161                                m_storage->pop_back();
    151162                                if ( m_relational )
    152163                                        relational_rebuild( dead_eindex );
     
    159170                                while ( i < size() )
    160171                                {
    161                                         auto& md = m_data[i];
     172                                        auto& md = ( *m_storage )[i];
    162173                                        if ( f( md ) )
    163174                                                remove_by_index( i );
     
    167178                        }
    168179
    169                         virtual void destroy( value_type* )
    170                         {
    171                                 // cleanup
     180                        virtual void on_attach( handle_type, handle_type child ) final
     181                        {
     182                                if ( m_relational )
     183                                {
     184                                        relational_recursive_rebuild( child );
     185                                }
    172186                        }
    173187
    174188                        ~component()
    175189                        {
    176                                 clear();
     190                                clear_();
     191                                delete m_storage;
     192                                m_storage = nullptr;
    177193                        }
    178194                       
    179                         inline const value_type& operator[] ( index_type i ) const { return m_data[i]; }
    180                         inline value_type& operator[] ( index_type i ) { return m_data[i]; }
    181 
    182                         inline size_t size() const { return m_data.size(); }
    183 
    184                         inline iterator        begin() { return m_data.begin(); }
    185                         inline const_iterator  begin()  const { return m_data.begin(); }
    186 
    187                         inline iterator        end() { return m_data.end(); }
    188                         inline const_iterator  end()  const { return m_data.end(); }
    189 
    190                         inline virtual component_storage* storage() { return &m_data; }
     195                        inline const value_type& operator[] ( index_type i ) const { return ( *m_storage )[i]; }
     196                        inline value_type& operator[] ( index_type i ) { return ( *m_storage )[i]; }
     197
     198                        inline size_t size() const { return m_storage->size(); }
     199
     200                        inline iterator        begin() { return m_storage->begin(); }
     201                        inline const_iterator  begin()  const { return m_storage->begin(); }
     202
     203                        inline iterator        end() { return m_storage->end(); }
     204                        inline const_iterator  end()  const { return m_storage->end(); }
     205
     206                        inline virtual component_storage* storage() { return m_storage; }
    191207                protected:
    192208                        ecs_type&        m_ecs;
    193                         storage_type     m_data;
     209                        storage_type*    m_storage;
    194210                private:
    195211                        void swap( handle_type a, handle_type b )
     
    197213                                index_type ai = m_index.get( a );
    198214                                index_type bi = m_index.get( b );
     215                                if ( ai < 0 || bi < 0 ) return;
    199216                                m_index.swap( a, b );
    200                                 value_type t = nv::move( m_data[ai] );
    201                                 m_data[ai] = nv::move( m_data[bi] );
    202                                 m_data[bi] = nv::move( t );
     217                                value_type t = nv::move( ( *m_storage )[ai] );
     218                                ( *m_storage )[ai] = nv::move( ( *m_storage )[bi] );
     219                                ( *m_storage )[bi] = nv::move( t );
    203220                        }
    204221
    205222                        handle_type extract_owner( index_type i )
    206223                        {
    207                                 return *(handle_type*)( &( m_data[i] ) );
     224                                return *(handle_type*)( &( ( *m_storage )[i] ) );
    208225                        }
    209226
     
    226243                                }
    227244                        }
     245
     246                        void relational_recursive_rebuild( handle_type h )
     247                        {
     248                                handle_type p = m_ecs.get_parent( h );
     249                                if ( !p ) return;
     250                                if ( m_index.get( h ) < m_index.get( p ) )
     251                                {
     252                                        swap( h, p );
     253                                        for ( auto c : m_ecs.children( h ) )
     254                                                relational_recursive_rebuild( c );
     255                                }
     256                        }
     257
    228258                        bool             m_relational;
    229259                        index_table_type m_index;
  • trunk/nv/ecs/ecs.hh

    r549 r550  
    2929{
    3030
    31         namespace lua
    32         {
    33                 class stack_proxy;
    34         }
    35 
    3631        namespace ecs
    3732        {
    38 
    39                 namespace detail
    40                 {
    41                         template<typename, typename T>
    42                         struct has_update
    43                         {
    44                                 static_assert( nv::integral_constant<T, false>::value, "Second template parameter needs to be of function type." );
    45                         };
    46 
    47                         template< typename C, typename Ret, typename... Args >
    48                         struct has_update<C, Ret( Args... )>
    49                         {
    50                         private:
    51                                 template<typename T>
    52                                 static constexpr auto check( T* )
    53                                         -> typename nv::is_same< decltype( nv::declval<T>().update( nv::declval<Args>()... ) ), Ret >::type;
    54 
    55                                 template<typename>
    56                                 static constexpr nv::false_type check( ... );
    57                         public:
    58                                 typedef decltype( check<C>( 0 ) ) type;
    59                                 static constexpr bool value = type::value;
    60                         };
    61 
    62                         template < typename S, typename T, typename Cs >
    63                         struct has_ct_update_helper;
    64 
    65                         template < typename S, typename T, typename... Cs >
    66                         struct has_ct_update_helper< S, T, mpl::list< Cs... > >
    67                         {
    68                                 using type = detail::has_update<S, void( Cs&..., T ) >;
    69                         };
    70 
    71                         template < typename S, typename E, typename T, typename Cs >
    72                         struct has_ect_update_helper;
    73 
    74                         template < typename S, typename E, typename T, typename... Cs >
    75                         struct has_ect_update_helper< S, E, T, mpl::list< Cs... > >
    76                         {
    77                                 using type = detail::has_update<S, void( E&, Cs&..., T ) >;
    78                         };
    79 
    80                         template < typename S, typename E, typename M, typename Cs >
    81                         struct has_ec_message_helper;
    82 
    83                         template < typename S, typename E, typename M, typename... Cs >
    84                         struct has_ec_message_helper< S, E, M, mpl::list< Cs... > >
    85                         {
    86                                 using type = detail::has_message<S, void( const M&, E&, Cs&... ) >;
    87                         };
    88 
    89                         template < typename S, typename M, typename Cs >
    90                         struct has_c_message_helper;
    91 
    92                         template < typename S, typename M, typename... Cs >
    93                         struct has_c_message_helper< S, M, mpl::list< Cs... > >
    94                         {
    95                                 using type = detail::has_message<S, void( const M&, Cs&... ) >;
    96                         };
    97 
    98                 }
    99 
    100 
    101 
    102                 template < typename E, typename S, typename T >
    103                 using has_ecs_update = detail::has_update<S, void( E&, T ) >;
    104 
    105                 template < typename S, typename Cs, typename T >
    106                 using has_component_update = typename detail::has_ct_update_helper<S, T, Cs >::type;
    107 
    108                 template < typename E, typename S, typename Cs, typename T >
    109                 using has_ecs_component_update = typename detail::has_ect_update_helper<S, E, T, Cs >::type;
    110 
    111                 template < typename S, typename Cs, typename M >
    112                 using has_component_message = typename detail::has_c_message_helper<S, M, Cs >::type;
    113 
    114                 template < typename E, typename S, typename Cs, typename M >
    115                 using has_ecs_component_message = typename detail::has_ec_message_helper<S, E, M, Cs >::type;
    116 
    117                 template < typename E, typename S, typename M >
    118                 using has_ecs_message = detail::has_message<S, void( const M&, E& ) >;
    11933
    12034                template < typename Handle, typename MessageList, typename Time = f32 >
     
    12943                        using base_type::message;
    13044
    131                         using update_handler = function< void( time_type ) >;
     45                        using update_handler  = function< void( time_type ) >;
     46                        using destroy_handler = function< void( void* ) >;
     47                        using create_handler  = function< void( handle_type, void*, const lua::stack_proxy& ) >;
    13248
    13349                        class component_interface
    13450                        {
    13551                        public:
    136                                 virtual void update( time_type dtime ) = 0;
    137                                 virtual void clear() = 0;
    138                                 virtual void initialize( handle_type, lua::stack_proxy& ) = 0;
     52                                virtual void clear_() = 0;
    13953                                virtual void remove( handle_type h ) = 0;
     54                                virtual void on_attach( handle_type parent, handle_type child ) = 0;
    14055                                virtual void* get_raw( handle_type h ) = 0;
     56                                virtual void* insert_raw( handle_type h ) = 0;
    14157                                virtual const void* get_raw( handle_type h ) const = 0;
    14258                                virtual component_storage* storage() = 0;
     59                                virtual uint32 temp_index( handle_type h ) const = 0;
     60
     61                                void run_create( handle_type h, const lua::stack_proxy& p )
     62                                {
     63                                        void* c = insert_raw( h );
     64                                        for ( auto cf : m_create )
     65                                                cf( h, c, p );
     66                                }
     67
     68                                vector< create_handler >  m_create;
     69                                vector< destroy_handler > m_destroy;
     70
    14371                        };
    14472
     
    291219                        {
    292220                                register_handler< System >( name, (System*)( c ) );
     221                                register_component_helper< System >( c, has_components< System >::type{} );
    293222                                register_ecs_update< System >( (System*)( c ),
    294223                                        has_ecs_update< this_type, System, time_type >::type{} );
     224                        }
     225
     226                        template< typename System >
     227                        void register_component_helper( System* c, true_type&& )
     228                        {
     229                                using component_list = System::components;
     230                                register_component_messages< System, component_list >( c, message_list{} );
     231                                register_ecs_component_update< System >( c, component_list{},
     232                                        has_ecs_component_update< this_type, System, component_list, time_type >::type{} );
     233                                register_component_update< System >( c, component_list{},
     234                                        has_component_update< System, component_list, time_type >::type{} );
     235                        }
     236
     237                        template< typename System >
     238                        void register_component_helper( System*, false_type&& )
     239                        {
    295240                        }
    296241
     
    309254                                register_ecs_update< Handler >( (Handler*)( c ),
    310255                                        has_ecs_update< this_type, Handler, time_type >::type{} );
     256                                register_destroy< Handler, Component >( (Handler*)( c ),
     257                                        has_destroy< Handler, Component >::type{} );
     258                                register_create< Handler, Component, handle_type >( (Handler*)( c ),
     259                                        has_create< Handler, Component, handle_type >::type{} );
    311260                                //                              auto s = c->storage();
    312261                                //                              m_cstorage.push_back( s );
     
    323272                        {
    324273                                update_time( dtime );
    325                                 for ( auto c : m_components )
    326                                         c->update( dtime );
    327274                                for ( auto u : m_update_handlers )
    328275                                        u( dtime );
     
    333280                                reset_events();
    334281                                for ( auto c : m_components )
    335                                         c->clear();
     282                                        c->clear_();
    336283                                m_handles.clear();
    337284                        }
     
    349296                                m_handles.detach( child );
    350297                                m_handles.attach( parent, child );
     298                                for ( auto c : m_components )
     299                                        c->on_attach( parent, child );
     300                        }
     301
     302                        template< typename Component >
     303                        uint32 get_debug_index( handle_type h )
     304                        {
     305                                return get_interface<Component>()->temp_index( h );
    351306                        }
    352307
     
    364319                        {
    365320                                return h ? m_handles.first( h ) : handle_type();
     321                        }
     322
     323                        bool is_valid( handle_type h ) const
     324                        {
     325                                return m_handles.is_valid( h );
    366326                        }
    367327
     
    542502                        }
    543503
     504                        template < typename System, typename Component >
     505                        void register_destroy( System* s, true_type&& )
     506                        {
     507                                component_interface* ci = get_interface<Component>();
     508                                NV_ASSERT( ci, "Unregistered component!" );
     509                                ci->m_destroy.push_back( [=] ( void* data )
     510                                {
     511                                        s->destroy( *((Component*)data) );
     512                                }
     513                                );
     514                        }
     515
     516                        template < typename System, typename Component, typename Handle >
     517                        void register_create( System* s, true_type&& )
     518                        {
     519                                component_interface* ci = get_interface<Component>();
     520                                NV_ASSERT( ci, "Unregistered component!" );
     521                                ci->m_create.push_back( [=] ( Handle h, void* data, const lua::stack_proxy& p )
     522                                {
     523                                        s->create( h, *( (Component*)data ), p );
     524                                }
     525                                );
     526                        }
     527
    544528                        template < typename System, typename C, typename... Cs >
    545529                        void register_component_update( System* s, mpl::list< C, Cs...>&&, true_type&& )
     
    578562                        void register_ecs_update( System*, false_type&& ) {}
    579563
     564                        template < typename System, typename Component >
     565                        void register_destroy( System*, false_type&& ) {}
     566
     567                        template < typename System, typename Component, typename Handle >
     568                        void register_create( System*, false_type&& ) {}
     569
    580570                        template < typename System, typename... Cs >
    581571                        void register_component_update( System*, mpl::list< Cs...>&&, false_type&& ) {}
  • trunk/nv/ecs/message_queue.hh

    r549 r550  
    2121#include <nv/stl/functional/function.hh>
    2222#include <nv/core/types.hh>
     23#include <nv/ecs/field_detection.hh>
    2324
    2425namespace nv
     
    2728        namespace ecs
    2829        {
    29 
    30                 namespace detail
    31                 {
    32                         template<typename, typename T>
    33                         struct has_message
    34                         {
    35                                 static_assert( nv::integral_constant<T, false>::value, "Second template parameter needs to be of function type." );
    36                         };
    37 
    38                         template< typename C, typename Ret, typename... Args >
    39                         struct has_message<C, Ret( Args... )>
    40                         {
    41                         private:
    42                                 template<typename T>
    43                                 static constexpr auto check( T* )
    44                                         -> typename nv::is_same< decltype( nv::declval<T>().on( nv::declval<Args>()... ) ), Ret >::type;
    45 
    46                                 template<typename>
    47                                 static constexpr nv::false_type check( ... );
    48 
    49                         public:
    50                                 typedef decltype( check<C>( 0 ) ) type;
    51 
    52                                 static constexpr bool value = type::value;
    53                         };
    54                 }
    55 
    56                 template < typename S, typename M >
    57                 using has_message = detail::has_message<S, void( const M& ) >;
    5830
    5931                template < typename Payload, typename Message >
  • trunk/nv/interface/context.hh

    r535 r550  
    6464        };
    6565
    66         class vertex_array_desc : private vertex_array_info
     66        class vertex_array_desc : public vertex_array_info
    6767        {
    6868        private:
     
    7777                        index_type = USHORT;
    7878                }
     79
     80                template < typename IDX >
     81                void set_index_buffer( buffer b, bool owner )
     82                {
     83                        index = b;
     84                        index_owner = owner;
     85                        index_type = type_to_enum< IDX >::type;
     86                }
     87
    7988
    8089                template < typename VTX, slot SLOT >
     
    101110                        {
    102111                                const datatype_info& info = get_datatype_info( cslot.etype );
    103                                 add_vertex_buffer( cslot.vslot, buf, info.base, info.elements, cslot.offset, descriptor.element_size(), false );
     112                                add_vertex_buffer( cslot.vslot, buf, info.base, info.elements, cslot.offset, descriptor.element_size(), false, false );
    104113                        }
    105114                }
     
    107116
    108117                // TODO: should be private
    109                 void add_vertex_buffer( slot location, buffer buf, datatype datatype, uint32 components, uint32 offset = 0, uint32 stride = 0, bool owner = true )
     118                void add_vertex_buffer( slot location, buffer buf, datatype datatype, uint32 components, uint32 offset, uint32 stride, bool interpolate, bool owner )
    110119                {
    111120                        NV_ASSERT( count < uint16( MAX_ATTRIBUTES ), "MAX_ATTRIBUTES reached!" );
    112121                        vertex_buffer_attribute& p = attr[count];
    113                         p.vbuffer    = buf;
    114                         p.dtype      = datatype;
    115                         p.components = components;
    116                         p.offset     = offset;
    117                         p.stride     = stride;
    118                         p.owner      = owner;
    119                         p.location   = location;
     122                        p.vbuffer     = buf;
     123                        p.dtype       = datatype;
     124                        p.components  = components;
     125                        p.offset      = offset;
     126                        p.stride      = stride;
     127                        p.owner       = owner;
     128                        p.interpolate = interpolate;
     129                        p.location    = location;
    120130                        count++;
    121131                }
     
    139149                        typedef slot_info< VTX, SLOT > vinfo;
    140150                        typedef datatype_traits< typename vinfo::value_type > dt_traits;
    141                         add_vertex_buffer( SLOT, vb, type_to_enum< typename dt_traits::base_type >::type, dt_traits::size, vinfo::offset, sizeof( VTX ), owned );
     151                        add_vertex_buffer( SLOT, vb, type_to_enum< typename dt_traits::base_type >::type, dt_traits::size, vinfo::offset, sizeof( VTX ), false, owned );
    142152                }
    143153
  • trunk/nv/interface/device.hh

    r535 r550  
    185185                size_t   stride;
    186186                slot     location;
     187                bool     interpolate;
    187188                bool     owner;
    188189        };
  • trunk/nv/interface/window_manager.hh

    r395 r550  
    2727        {
    2828        public:
    29                 virtual window* create_window( device* dev, uint16 width, uint16 height, bool fullscreen ) = 0;
     29                virtual window* create_window( device* dev, uint16 width, uint16 height, bool fullscreen, bool msaa = false ) = 0;
    3030                virtual void* adopt_window( void* sys_w_handle ) = 0;
    3131                virtual void sleep( uint32 ms ) = 0;
  • trunk/nv/sdl/sdl_window.hh

    r505 r550  
    2626                {
    2727                public:
    28                         window( device* dev, uint16 width, uint16 height, bool fullscreen = false );
     28                        window( device* dev, uint16 width, uint16 height, bool fullscreen = false, bool msaa = false );
    2929                        virtual void set_title( const string_view& title );
    3030                        virtual void swap_buffers();
  • trunk/nv/sdl/sdl_window_manager.hh

    r505 r550  
    2626                public:
    2727                        window_manager();
    28                         virtual nv::window* create_window( device* dev, uint16 width, uint16 height, bool fullscreen );
     28                        virtual nv::window* create_window( device* dev, uint16 width, uint16 height, bool fullscreen, bool msaa = false );
    2929                        virtual void* adopt_window( void* sys_w_handle );
    3030                        virtual void sleep( uint32 ms );
  • trunk/nv/stl/math/basic.hh

    r488 r550  
    148148                inline T floor( const T& x )
    149149                {
    150                         return detail::unary_functor< T >::call( floor, x );
     150                        return detail::unary_functor< T >::call( floorf, x );
    151151                }
    152152
     
    162162                inline T round( const T& x )
    163163                {
    164                         return detail::unary_functor< T >::call( round, x );
     164                        return detail::unary_functor< T >::call( roundf, x );
    165165                }
    166166
  • trunk/nv/stl/math/geometric.hh

    r471 r550  
    6666                }
    6767
     68                template < typename T, typename enable_if< is_floating_point<T>::value >::type* = nullptr >
     69                inline T inv_length( T v )
     70                {
     71                        return T( 1 ) / abs( x );
     72                }
     73
    6874                template < typename T, typename enable_if< is_fp_vec<T>::value >::type* = nullptr >
    6975                inline value_type_t<T> length( const T& v )
    7076                {
    7177                        return nv::sqrt( dot( v, v ) );
     78                }
     79
     80                template < typename T, typename enable_if< is_fp_vec<T>::value >::type* = nullptr >
     81                inline value_type_t<T> inv_length( const T& v )
     82                {
     83                        return T( 1 ) / nv::sqrt( dot( v, v ) );
    7284                }
    7385
  • trunk/nv/stl/type_traits/common.hh

    r505 r550  
    7777        template < typename T1, typename T2 >
    7878        constexpr bool is_same_v = is_same<T1, T2>::value;
     79
     80#if NV_COMPILER == NV_MSVC
     81        // preferred form
     82        template< typename... > using void_t = void;
     83#else
     84        template< typename... > struct void_acceptor { using type = void; };
     85        template< typename... T > using void_t = typename void_acceptor<T...>::type;
     86#endif
     87
     88        template < typename T > struct identity { using type = T; };
    7989
    8090        // TODO: these seem to simple compared to MSVC/GCC - so we'll leave them in
  • trunk/nv/stl/type_traits/experimental.hh

    r446 r550  
    2121namespace nv
    2222{
    23 
    24 #if NV_COMPILER == NV_MSVC
    25         // preferred form
    26         template< typename... > using void_t = void;
    27 #else
    28         template< typename... > struct void_acceptor { using type = void; };
    29         template< typename... T > using void_t = typename void_acceptor<T...>::type;
    30 #endif
    3123
    3224#if NV_COMPILER == NV_MSVC
  • trunk/nv/stl/vector.hh

    r533 r550  
    2828        using growable_static_storage = growing_storage< static_storage< T, N > >;
    2929
    30         template< typename T >
     30        template< typename T, typename InitializePolicy = policy_initialize_standard >
    3131        using vector =
    3232                random_access <
    33                                 growable_dynamic_storage< T > >;
     33                        growing_storage< dynamic_storage< T >, InitializePolicy > >;
    3434
    3535}
  • trunk/src/gfx/texture_font.cc

    r487 r550  
    111111        else
    112112        {
    113                 flags |= FT_LOAD_FORCE_AUTOHINT;
     113                //flags |= FT_LOAD_FORCE_AUTOHINT;
    114114        }
    115115
     
    122122                        FT_Library_SetLcdFilterWeights( reinterpret_cast<FT_Library>( m_rlibrary ), m_lcd_weights );
    123123                }
     124
    124125        }
    125126
  • trunk/src/gl/gl_context.cc

    r543 r550  
    4747                        static_cast<GLint>( vba.components ),
    4848                        nv::datatype_to_gl_enum( vba.dtype ),
    49                         GL_FALSE,
     49                        vba.interpolate ? GL_TRUE : GL_FALSE,
    5050                        static_cast<GLsizei>( vba.stride ),
    5151                        reinterpret_cast<void*>( vba.offset )
     
    693693        if ( m_render_state.multisample != multisample )
    694694        {
    695                 glDepthMask( multisample );
     695                enable( GL_MULTISAMPLE, multisample );
    696696                m_render_state.multisample = multisample;
    697697        }
     
    891891        m_active_slot = texture_slot( -1 );
    892892        force_apply_render_state( m_render_state );
     893        glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
    893894}
    894895
  • trunk/src/sdl/sdl_window.cc

    r505 r550  
    1515using namespace nv;
    1616
    17 sdl::window::window( device* dev, uint16 width, uint16 height, bool fullscreen )
     17sdl::window::window( device* dev, uint16 width, uint16 height, bool fullscreen, bool msaa )
    1818        : m_device( dev ), m_width( width ), m_height( height ), m_title("Nova Engine"), m_handle( nullptr )
    1919{
     
    2727        SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
    2828
    29         //      SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
    30         //      SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4 );
     29        if ( msaa )
     30        {
     31                SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
     32                SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4 );
     33        }
    3134
    3235        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
  • trunk/src/sdl/sdl_window_manager.cc

    r529 r550  
    2727}
    2828
    29 window* sdl::window_manager::create_window( device* dev, uint16 width, uint16 height, bool fullscreen )
     29window* sdl::window_manager::create_window( device* dev, uint16 width, uint16 height, bool fullscreen, bool msaa )
    3030{
    3131        if ( ! SDL_WasInit( SDL_INIT_VIDEO ) ) SDL_InitSubSystem( SDL_INIT_VIDEO );
    32         sdl::window* result = new sdl::window( dev, width, height, fullscreen );
     32        sdl::window* result = new sdl::window( dev, width, height, fullscreen, msaa );
    3333        primal_window = result->get_handle();
    3434        return result;
Note: See TracChangeset for help on using the changeset viewer.