- Timestamp:
- 08/20/14 12:50:51 (11 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/gl/gl_device.hh
r313 r316 58 58 virtual int get_attribute_location( program p, const string& name, bool fatal = true ) const; 59 59 virtual void prepare_program( program p ); 60 virtual const string& get_shader_header() const { return m_shader_header; } 60 61 virtual ~gl_device(); 61 62 protected: … … 69 70 void load_uniforms( gl_program_info* p ); 70 71 bool compile( uint32 sh_type, const std::string& shader_code, unsigned& glid ); 71 72 std::string m_shader_header; 72 73 const void* m_info; 73 74 entity_store< gl_texture_info, texture > m_textures; -
trunk/nv/gl/gl_enum.hh
r302 r316 41 41 unsigned int datatype_to_gl_enum( datatype type ); 42 42 datatype gl_enum_to_datatype( unsigned int gl_enum ); 43 std::string datatype_to_glsl_type( datatype type ); 43 44 44 45 } // namespace nv -
trunk/nv/interface/device.hh
r313 r316 144 144 virtual uint32 get_ticks() = 0; 145 145 virtual void delay( uint32 ms ) = 0; 146 virtual const string& get_shader_header() const = 0; 146 147 147 148 virtual texture create_texture( image_data* data, sampler asampler ) -
trunk/nv/interface/uniform.hh
r303 r316 114 114 public: 115 115 virtual engine_uniform_base* create( uniform_base* ) = 0; 116 virtual datatype get_datatype() const = 0; 116 117 virtual ~engine_uniform_factory_base() {} 117 118 }; … … 125 126 return new T( u ); 126 127 } 128 virtual datatype get_datatype() const { return type_to_enum<typename T::value_type>::type; } 127 129 }; 128 130 -
trunk/nv/lua/lua_nova.hh
r217 r316 13 13 namespace lua 14 14 { 15 void register_storage( state* a_state, const string& name, const string& constructor_name ); 15 16 void register_nova( state* a_state ); 16 17 } -
trunk/src/gl/gl_device.cc
r313 r316 47 47 #endif 48 48 49 m_shader_header = "#version 120\n"; 50 for ( auto& i : get_uniform_factory() ) 51 m_shader_header += "uniform "+datatype_to_glsl_type( i.second->get_datatype() )+" "+i.first+";\n"; 52 for ( auto& i : get_link_uniform_factory() ) 53 m_shader_header += "uniform sampler2D "+i.first+";\n"; 49 54 } 50 55 -
trunk/src/gl/gl_enum.cc
r302 r316 277 277 } 278 278 } 279 280 std::string nv::datatype_to_glsl_type( datatype type ) 281 { 282 switch( type ) 283 { 284 case INT : return "int"; 285 case FLOAT : return "float"; 286 case FLOAT_VECTOR_2 : return "vec2"; 287 case FLOAT_VECTOR_3 : return "vec3"; 288 case FLOAT_VECTOR_4 : return "vec4"; 289 case FLOAT_MATRIX_2 : return "mat2"; 290 case FLOAT_MATRIX_3 : return "mat3"; 291 case FLOAT_MATRIX_4 : return "mat4"; 292 case INT_VECTOR_2 : return "ivec2"; 293 case INT_VECTOR_3 : return "ivec3"; 294 case INT_VECTOR_4 : return "ivec4"; 295 default : return "error"; 296 } 297 } -
trunk/src/lua/lua_nova.cc
r217 r316 680 680 lua_rawget( L, -2 ); 681 681 682 if ( !lua_isnil( L, -1 ) ) luaL_error( L, "lua.nova - storage \"%s\" already registered!", lua_tolstring( L, lua_upvalueindex(1), 0 ) );682 if ( !lua_isnil( L, -1 ) ) luaL_error( L, "lua.nova - storage \"%s\" already registered!", lua_tolstring( L, 1, 0 ) ); 683 683 684 684 lua_newtable( L ); // g t … … 805 805 lua_settop( L, stack ); 806 806 } 807 808 void nv::lua::register_storage( state* a_state, const string& name, const string& constructor_name ) 809 { 810 // TODO: error checking 811 lua_State* L = a_state->get_raw(); 812 int stack = lua_gettop( L ); 813 // TODO: check if nova is loaded 814 lua_pushcfunction( L, nova_register_storage ); 815 lua_pushstring( L, name.c_str() ); 816 lua_call( L, 1, 1 ); 817 lua_setglobal( L, constructor_name.c_str() ); 818 lua_settop( L, stack ); 819 }
Note: See TracChangeset
for help on using the changeset viewer.