mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 08:39:18 +02:00
multi texturing support for display list mode
This commit is contained in:
@@ -42,7 +42,12 @@ enum stream {
|
||||
};
|
||||
|
||||
unsigned int const basic_streams { stream::position | stream::normal | stream::texture };
|
||||
unsigned int const color_streams{ stream::position | stream::color | stream::texture };
|
||||
unsigned int const color_streams { stream::position | stream::color | stream::texture };
|
||||
|
||||
struct stream_units {
|
||||
|
||||
GLint texture { GL_TEXTURE0 }; // unit associated with main texture data stream. TODO: allow multiple units per stream
|
||||
};
|
||||
|
||||
typedef std::vector<basic_vertex> vertex_array;
|
||||
|
||||
@@ -98,11 +103,11 @@ public:
|
||||
append( vertex_array &Vertices, geometry_handle const &Geometry );
|
||||
// draws geometry stored in specified chunk
|
||||
void
|
||||
draw( geometry_handle const &Geometry, unsigned int const Streams = basic_streams );
|
||||
draw( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams = basic_streams );
|
||||
// draws geometry stored in supplied list of chunks
|
||||
template <typename Iterator_>
|
||||
void
|
||||
draw( Iterator_ First, Iterator_ Last, unsigned int const Streams = basic_streams ) { while( First != Last ) { draw( *First, Streams ); ++First; } }
|
||||
draw( Iterator_ First, Iterator_ Last, stream_units const &Units, unsigned int const Streams = basic_streams ) { while( First != Last ) { draw( *First, Units, Streams ); ++First; } }
|
||||
// frees subclass-specific resources associated with the bank, typically called when the bank wasn't in use for a period of time
|
||||
void
|
||||
release();
|
||||
@@ -145,7 +150,7 @@ private:
|
||||
// replace() subclass details
|
||||
virtual void replace_( geometry_handle const &Geometry ) = 0;
|
||||
// draw() subclass details
|
||||
virtual void draw_( geometry_handle const &Geometry, unsigned int const Streams ) = 0;
|
||||
virtual void draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) = 0;
|
||||
// resource release subclass details
|
||||
virtual void release_() = 0;
|
||||
};
|
||||
@@ -186,8 +191,8 @@ private:
|
||||
replace_( geometry_handle const &Geometry );
|
||||
// draw() subclass details
|
||||
void
|
||||
draw_( geometry_handle const &Geometry, unsigned int const Streams );
|
||||
// release () subclass details
|
||||
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams );
|
||||
// release() subclass details
|
||||
void
|
||||
release_();
|
||||
void
|
||||
@@ -195,7 +200,9 @@ private:
|
||||
void
|
||||
delete_buffer();
|
||||
void
|
||||
bind_streams( unsigned int const Streams );
|
||||
bind_streams( stream_units const &Units, unsigned int const Streams );
|
||||
void
|
||||
release_streams();
|
||||
|
||||
// members:
|
||||
static GLuint m_activebuffer; // buffer bound currently on the opengl end, if any
|
||||
@@ -236,7 +243,7 @@ private:
|
||||
replace_( geometry_handle const &Geometry );
|
||||
// draw() subclass details
|
||||
void
|
||||
draw_( geometry_handle const &Geometry, unsigned int const Streams );
|
||||
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams );
|
||||
// release () subclass details
|
||||
void
|
||||
release_();
|
||||
@@ -282,6 +289,9 @@ public:
|
||||
// provides direct access to vertex data of specfied chunk
|
||||
vertex_array const &
|
||||
vertices( geometry_handle const &Geometry ) const;
|
||||
// sets target texture unit for the texture data stream
|
||||
stream_units &
|
||||
units() { return m_units; }
|
||||
|
||||
private:
|
||||
// types:
|
||||
@@ -294,6 +304,7 @@ private:
|
||||
// members:
|
||||
geometrybanktimepointpair_sequence m_geometrybanks;
|
||||
garbage_collector<geometrybanktimepointpair_sequence> m_garbagecollector { m_geometrybanks, 60, 120, "geometry buffer" };
|
||||
stream_units m_units;
|
||||
|
||||
// methods
|
||||
inline
|
||||
|
||||
Reference in New Issue
Block a user