- Timestamp:
- 03/09/17 13:33:03 (8 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/ecs/component.hh
r545 r550 59 59 60 60 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; 63 64 m_ecs.register_component<component_type, Handler>( a_name, this ); 64 65 65 if ( reserve != 0 ) 66 66 { 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 72 76 73 77 inline value_type& insert( handle_type h ) 74 78 { 75 79 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!" ); 77 81 NV_UNUSED( i ); 78 m_ data.emplace_back();79 return m_ data.back();82 m_storage->emplace_back(); 83 return m_storage->back(); 80 84 } 81 85 … … 84 88 { 85 89 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!" ); 87 91 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 91 101 92 102 bool exists( handle_type h ) … … 95 105 } 96 106 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] ); 106 117 m_index.clear(); 107 m_data.clear();118 m_storage->clear(); 108 119 } 109 120 … … 111 122 { 112 123 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; 114 125 } 115 126 const value_type* get( handle_type h ) const 116 127 { 117 128 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; 119 130 } 120 131 … … 122 133 const void* get_raw( handle_type h ) const { return get( h ); } 123 134 124 virtual void remove( handle_type h ) override135 virtual void remove( handle_type h ) final 125 136 { 126 137 value_type* v = get( h ); 127 138 if ( v == nullptr ) return; 128 destroy( v );139 call_destroy( v ); 129 140 index_type dead_eindex = m_index.remove_swap( h ); 130 141 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(); 136 147 if ( m_relational ) 137 148 relational_rebuild( dead_eindex ); … … 141 152 { 142 153 if ( i > size() ) return; 143 destroy( &m_data[i] );154 call_destroy( &(*m_storage)[i] ); 144 155 index_type dead_eindex = m_index.remove_swap_by_index( i ); 145 156 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(); 151 162 if ( m_relational ) 152 163 relational_rebuild( dead_eindex ); … … 159 170 while ( i < size() ) 160 171 { 161 auto& md = m_data[i];172 auto& md = ( *m_storage )[i]; 162 173 if ( f( md ) ) 163 174 remove_by_index( i ); … … 167 178 } 168 179 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 } 172 186 } 173 187 174 188 ~component() 175 189 { 176 clear(); 190 clear_(); 191 delete m_storage; 192 m_storage = nullptr; 177 193 } 178 194 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; } 191 207 protected: 192 208 ecs_type& m_ecs; 193 storage_type m_data;209 storage_type* m_storage; 194 210 private: 195 211 void swap( handle_type a, handle_type b ) … … 197 213 index_type ai = m_index.get( a ); 198 214 index_type bi = m_index.get( b ); 215 if ( ai < 0 || bi < 0 ) return; 199 216 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 ); 203 220 } 204 221 205 222 handle_type extract_owner( index_type i ) 206 223 { 207 return *(handle_type*)( &( m_data[i] ) );224 return *(handle_type*)( &( ( *m_storage )[i] ) ); 208 225 } 209 226 … … 226 243 } 227 244 } 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 228 258 bool m_relational; 229 259 index_table_type m_index; -
trunk/nv/ecs/ecs.hh
r549 r550 29 29 { 30 30 31 namespace lua32 {33 class stack_proxy;34 }35 36 31 namespace ecs 37 32 { 38 39 namespace detail40 {41 template<typename, typename T>42 struct has_update43 {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& ) >;119 33 120 34 template < typename Handle, typename MessageList, typename Time = f32 > … … 129 43 using base_type::message; 130 44 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& ) >; 132 48 133 49 class component_interface 134 50 { 135 51 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; 139 53 virtual void remove( handle_type h ) = 0; 54 virtual void on_attach( handle_type parent, handle_type child ) = 0; 140 55 virtual void* get_raw( handle_type h ) = 0; 56 virtual void* insert_raw( handle_type h ) = 0; 141 57 virtual const void* get_raw( handle_type h ) const = 0; 142 58 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 143 71 }; 144 72 … … 291 219 { 292 220 register_handler< System >( name, (System*)( c ) ); 221 register_component_helper< System >( c, has_components< System >::type{} ); 293 222 register_ecs_update< System >( (System*)( c ), 294 223 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 { 295 240 } 296 241 … … 309 254 register_ecs_update< Handler >( (Handler*)( c ), 310 255 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{} ); 311 260 // auto s = c->storage(); 312 261 // m_cstorage.push_back( s ); … … 323 272 { 324 273 update_time( dtime ); 325 for ( auto c : m_components )326 c->update( dtime );327 274 for ( auto u : m_update_handlers ) 328 275 u( dtime ); … … 333 280 reset_events(); 334 281 for ( auto c : m_components ) 335 c->clear ();282 c->clear_(); 336 283 m_handles.clear(); 337 284 } … … 349 296 m_handles.detach( child ); 350 297 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 ); 351 306 } 352 307 … … 364 319 { 365 320 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 ); 366 326 } 367 327 … … 542 502 } 543 503 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 544 528 template < typename System, typename C, typename... Cs > 545 529 void register_component_update( System* s, mpl::list< C, Cs...>&&, true_type&& ) … … 578 562 void register_ecs_update( System*, false_type&& ) {} 579 563 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 580 570 template < typename System, typename... Cs > 581 571 void register_component_update( System*, mpl::list< Cs...>&&, false_type&& ) {} -
trunk/nv/ecs/message_queue.hh
r549 r550 21 21 #include <nv/stl/functional/function.hh> 22 22 #include <nv/core/types.hh> 23 #include <nv/ecs/field_detection.hh> 23 24 24 25 namespace nv … … 27 28 namespace ecs 28 29 { 29 30 namespace detail31 {32 template<typename, typename T>33 struct has_message34 {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& ) >;58 30 59 31 template < typename Payload, typename Message > -
trunk/nv/interface/context.hh
r535 r550 64 64 }; 65 65 66 class vertex_array_desc : p rivatevertex_array_info66 class vertex_array_desc : public vertex_array_info 67 67 { 68 68 private: … … 77 77 index_type = USHORT; 78 78 } 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 79 88 80 89 template < typename VTX, slot SLOT > … … 101 110 { 102 111 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 ); 104 113 } 105 114 } … … 107 116 108 117 // 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 ) 110 119 { 111 120 NV_ASSERT( count < uint16( MAX_ATTRIBUTES ), "MAX_ATTRIBUTES reached!" ); 112 121 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; 120 130 count++; 121 131 } … … 139 149 typedef slot_info< VTX, SLOT > vinfo; 140 150 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 ); 142 152 } 143 153 -
trunk/nv/interface/device.hh
r535 r550 185 185 size_t stride; 186 186 slot location; 187 bool interpolate; 187 188 bool owner; 188 189 }; -
trunk/nv/interface/window_manager.hh
r395 r550 27 27 { 28 28 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; 30 30 virtual void* adopt_window( void* sys_w_handle ) = 0; 31 31 virtual void sleep( uint32 ms ) = 0; -
trunk/nv/sdl/sdl_window.hh
r505 r550 26 26 { 27 27 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 ); 29 29 virtual void set_title( const string_view& title ); 30 30 virtual void swap_buffers(); -
trunk/nv/sdl/sdl_window_manager.hh
r505 r550 26 26 public: 27 27 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 ); 29 29 virtual void* adopt_window( void* sys_w_handle ); 30 30 virtual void sleep( uint32 ms ); -
trunk/nv/stl/math/basic.hh
r488 r550 148 148 inline T floor( const T& x ) 149 149 { 150 return detail::unary_functor< T >::call( floor , x );150 return detail::unary_functor< T >::call( floorf, x ); 151 151 } 152 152 … … 162 162 inline T round( const T& x ) 163 163 { 164 return detail::unary_functor< T >::call( round , x );164 return detail::unary_functor< T >::call( roundf, x ); 165 165 } 166 166 -
trunk/nv/stl/math/geometric.hh
r471 r550 66 66 } 67 67 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 68 74 template < typename T, typename enable_if< is_fp_vec<T>::value >::type* = nullptr > 69 75 inline value_type_t<T> length( const T& v ) 70 76 { 71 77 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 ) ); 72 84 } 73 85 -
trunk/nv/stl/type_traits/common.hh
r505 r550 77 77 template < typename T1, typename T2 > 78 78 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; }; 79 89 80 90 // TODO: these seem to simple compared to MSVC/GCC - so we'll leave them in -
trunk/nv/stl/type_traits/experimental.hh
r446 r550 21 21 namespace nv 22 22 { 23 24 #if NV_COMPILER == NV_MSVC25 // preferred form26 template< typename... > using void_t = void;27 #else28 template< typename... > struct void_acceptor { using type = void; };29 template< typename... T > using void_t = typename void_acceptor<T...>::type;30 #endif31 23 32 24 #if NV_COMPILER == NV_MSVC -
trunk/nv/stl/vector.hh
r533 r550 28 28 using growable_static_storage = growing_storage< static_storage< T, N > >; 29 29 30 template< typename T >30 template< typename T, typename InitializePolicy = policy_initialize_standard > 31 31 using vector = 32 32 random_access < 33 growable_dynamic_storage< T> >;33 growing_storage< dynamic_storage< T >, InitializePolicy > >; 34 34 35 35 } -
trunk/src/gfx/texture_font.cc
r487 r550 111 111 else 112 112 { 113 flags |= FT_LOAD_FORCE_AUTOHINT;113 //flags |= FT_LOAD_FORCE_AUTOHINT; 114 114 } 115 115 … … 122 122 FT_Library_SetLcdFilterWeights( reinterpret_cast<FT_Library>( m_rlibrary ), m_lcd_weights ); 123 123 } 124 124 125 } 125 126 -
trunk/src/gl/gl_context.cc
r543 r550 47 47 static_cast<GLint>( vba.components ), 48 48 nv::datatype_to_gl_enum( vba.dtype ), 49 GL_FALSE,49 vba.interpolate ? GL_TRUE : GL_FALSE, 50 50 static_cast<GLsizei>( vba.stride ), 51 51 reinterpret_cast<void*>( vba.offset ) … … 693 693 if ( m_render_state.multisample != multisample ) 694 694 { 695 glDepthMask(multisample );695 enable( GL_MULTISAMPLE, multisample ); 696 696 m_render_state.multisample = multisample; 697 697 } … … 891 891 m_active_slot = texture_slot( -1 ); 892 892 force_apply_render_state( m_render_state ); 893 glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST ); 893 894 } 894 895 -
trunk/src/sdl/sdl_window.cc
r505 r550 15 15 using namespace nv; 16 16 17 sdl::window::window( device* dev, uint16 width, uint16 height, bool fullscreen )17 sdl::window::window( device* dev, uint16 width, uint16 height, bool fullscreen, bool msaa ) 18 18 : m_device( dev ), m_width( width ), m_height( height ), m_title("Nova Engine"), m_handle( nullptr ) 19 19 { … … 27 27 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); 28 28 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 } 31 34 32 35 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); -
trunk/src/sdl/sdl_window_manager.cc
r529 r550 27 27 } 28 28 29 window* sdl::window_manager::create_window( device* dev, uint16 width, uint16 height, bool fullscreen )29 window* sdl::window_manager::create_window( device* dev, uint16 width, uint16 height, bool fullscreen, bool msaa ) 30 30 { 31 31 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 ); 33 33 primal_window = result->get_handle(); 34 34 return result;
Note: See TracChangeset
for help on using the changeset viewer.