16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 17:09:19 +02:00

reformat: remove redundant 'inline' specifier

This commit is contained in:
jerrrrycho
2026-07-04 05:58:21 +02:00
parent b4b6686320
commit 6e4d000ddb
85 changed files with 877 additions and 988 deletions

View File

@@ -40,35 +40,28 @@ public:
void
calculate(glm::mat4 const &Projection, glm::mat4 const &Modelview);
// returns true if specified point is inside of the frustum
inline
bool
bool
point_inside( glm::vec3 const &Point ) const { return point_inside( Point.x, Point.y, Point.z ); }
inline
bool
bool
point_inside( float3 const &Point ) const { return point_inside( Point.x, Point.y, Point.z ); }
bool
point_inside( float const X, float const Y, float const Z ) const;
point_inside( float X, float Y, float Z ) const;
// tests if the sphere is in frustum, returns the distance between origin and sphere centre
inline
float
float
sphere_inside( glm::dvec3 const &Center, float const Radius ) const { return sphere_inside( static_cast<float>( Center.x ), static_cast<float>( Center.y ), static_cast<float>( Center.z ), Radius ); }
inline
float
float
sphere_inside( glm::vec3 const &Center, float const Radius ) const { return sphere_inside( Center.x, Center.y, Center.z, Radius ); }
inline
float
float
sphere_inside( float3 const &Center, float const Radius ) const { return sphere_inside( Center.x, Center.y, Center.z, Radius ); }
float
sphere_inside( float const X, float const Y, float const Z, float const Radius ) const;
sphere_inside( float X, float Y, float Z, float Radius ) const;
// returns true if specified cube is inside of the frustum. Size = half of the length
inline
bool
bool
cube_inside( glm::vec3 const &Center, float const Size ) const { return cube_inside( Center.x, Center.y, Center.z, Size ); }
inline
bool
bool
cube_inside( float3 const &Center, float const Size ) const { return cube_inside( Center.x, Center.y, Center.z, Size ); }
bool
cube_inside( float const X, float const Y, float const Z, float const Size ) const;
cube_inside( float X, float Y, float Z, float Size ) const;
private:
// types:
@@ -79,7 +72,7 @@ private:
// methods:
void
normalize_plane( side const Side ); // normalizes a plane (A side) from the frustum
normalize_plane( side Side ); // normalizes a plane (A side) from the frustum
// members:
float m_frustum[6][4]; // holds the A B C and D values (normal & distance) for each side of the frustum.

View File

@@ -28,10 +28,10 @@ struct basic_vertex {
{}
static basic_vertex convert(world_vertex const &world, glm::dvec3 const &origin);
world_vertex to_world(glm::dvec3 const &origin = glm::dvec3(0.)) const;
void serialize( std::ostream&, bool const Tangent = false ) const;
void deserialize( std::istream&, bool const Tangent = false );
void serialize_packed( std::ostream&, bool const Tangent = false ) const;
void deserialize_packed( std::istream&, bool const Tangent = false );
void serialize( std::ostream&, bool Tangent = false ) const;
void deserialize( std::istream&, bool Tangent = false );
void serialize_packed( std::ostream&, bool Tangent = false ) const;
void deserialize_packed( std::istream&, bool Tangent = false );
};
struct vertex_userdata{
@@ -65,7 +65,7 @@ using vertex_array = std::vector<basic_vertex>;
using userdata_array = std::vector<vertex_userdata>;
using index_array = std::vector<basic_index>;
void calculate_tangents( vertex_array &vertices, index_array const &indices, int const type );
void calculate_tangents( vertex_array &vertices, index_array const &indices, int type );
void calculate_indices( index_array &Indices, vertex_array &Vertices, userdata_array &Userdata, float tolerancescale = 1.0f );
// generic geometry bank class, allows storage, update and drawing of geometry chunks
@@ -79,8 +79,8 @@ struct geometry_handle {
bank( Bank ), chunk( Chunk )
{}
// methods
inline
operator std::uint64_t() const {
operator std::uint64_t() const {
/*
return bank << 14 | chunk; }
*/
@@ -110,17 +110,17 @@ public:
// methods:
// creates a new geometry chunk of specified type from supplied data. returns: handle to the chunk or NULL
auto create( vertex_array &Vertices, userdata_array& Userdata, unsigned int const Type ) -> geometry_handle;
auto create( vertex_array &Vertices, userdata_array& Userdata, unsigned int Type ) -> geometry_handle;
// creates a new indexed geometry chunk of specified type from supplied data. returns: handle to the chunk or NULL
auto create( index_array &Indices, vertex_array &Vertices, userdata_array& Userdata, unsigned int const Type ) -> geometry_handle;
auto create( index_array &Indices, vertex_array &Vertices, userdata_array& Userdata, unsigned int Type ) -> geometry_handle;
// replaces vertex data of specified chunk with the supplied data, starting from specified offset
auto replace( vertex_array &Vertices, userdata_array& Userdata, geometry_handle const &Geometry, std::size_t const Offset = 0 ) -> bool;
auto replace( vertex_array &Vertices, userdata_array& Userdata, geometry_handle const &Geometry, std::size_t Offset = 0 ) -> bool;
// adds supplied vertex data at the end of specified chunk
auto append( vertex_array &Vertices, userdata_array& Userdata, geometry_handle const &Geometry ) -> bool;
// draws geometry stored in specified chunk
auto draw( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams = basic_streams ) -> std::size_t;
auto draw( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams = basic_streams ) -> std::size_t;
// draws geometry stored in specified chunk N times via glDrawElementsInstanced*
auto draw_instanced( geometry_handle const &Geometry, stream_units const &Units, std::size_t const InstanceCount, unsigned int const Streams = basic_streams ) -> std::size_t;
auto draw_instanced( geometry_handle const &Geometry, stream_units const &Units, std::size_t InstanceCount, unsigned int Streams = basic_streams ) -> std::size_t;
// draws geometry stored in supplied list of chunks
template <typename Iterator_>
auto draw( Iterator_ First, Iterator_ Last, stream_units const &Units, unsigned int const Streams = basic_streams ) ->std::size_t {
@@ -164,11 +164,9 @@ protected:
using geometrychunk_sequence = std::vector<geometry_chunk>;
// methods
inline
auto chunk( geometry_handle const Geometry ) -> geometry_chunk & {
auto chunk( geometry_handle const Geometry ) -> geometry_chunk & {
return m_chunks[ Geometry.chunk - 1 ]; }
inline
auto chunk( geometry_handle const Geometry ) const -> geometry_chunk const & {
auto chunk( geometry_handle const Geometry ) const -> geometry_chunk const & {
return m_chunks[ Geometry.chunk - 1 ]; }
// members:
@@ -181,7 +179,7 @@ private:
// replace() subclass details
virtual void replace_( geometry_handle const &Geometry ) = 0;
// draw() subclass details
virtual auto draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) -> std::size_t = 0;
virtual auto draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams ) -> std::size_t = 0;
// draw_instanced() subclass details. Default implementation falls back to N regular draws.
virtual auto draw_instanced_( geometry_handle const &Geometry, stream_units const &Units, std::size_t const InstanceCount, unsigned int const Streams ) -> std::size_t {
std::size_t count { 0 };
@@ -206,18 +204,18 @@ public:
// registers a new geometry bank. returns: handle to the bank
auto register_bank(std::unique_ptr<geometry_bank> bank) -> geometrybank_handle;
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
auto create_chunk( vertex_array &Vertices, userdata_array &Userdata, geometrybank_handle const &Geometry, int const Type ) -> geometry_handle;
auto create_chunk( vertex_array &Vertices, userdata_array &Userdata, geometrybank_handle const &Geometry, int Type ) -> geometry_handle;
// creates a new indexed geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
auto create_chunk( index_array &Indices, vertex_array &Vertices, userdata_array &Userdata, geometrybank_handle const &Geometry, unsigned int const Type ) -> geometry_handle;
auto create_chunk( index_array &Indices, vertex_array &Vertices, userdata_array &Userdata, geometrybank_handle const &Geometry, unsigned int Type ) -> geometry_handle;
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
auto replace( vertex_array &Vertices, userdata_array &Userdata, geometry_handle const &Geometry, std::size_t const Offset = 0 ) -> bool;
auto replace( vertex_array &Vertices, userdata_array &Userdata, geometry_handle const &Geometry, std::size_t Offset = 0 ) -> bool;
// adds supplied vertex data at the end of specified chunk
auto append( vertex_array &Vertices, userdata_array &Userdata, geometry_handle const &Geometry ) -> bool;
// draws geometry stored in specified chunk
void draw( geometry_handle const &Geometry, unsigned int const Streams = basic_streams );
void draw( geometry_handle const &Geometry, unsigned int Streams = basic_streams );
// draws geometry stored in specified chunk InstanceCount times via GPU instancing.
// The shader reads per-instance modelview matrices from instance_ubo[gl_InstanceID].
void draw_instanced( geometry_handle const &Geometry, std::size_t const InstanceCount, unsigned int const Streams = basic_streams );
void draw_instanced( geometry_handle const &Geometry, std::size_t InstanceCount, unsigned int Streams = basic_streams );
template <typename Iterator_>
void draw( Iterator_ First, Iterator_ Last, unsigned int const Streams = basic_streams ) {
while( First != Last ) {
@@ -246,15 +244,12 @@ private:
stream_units m_units;
// methods
inline
auto valid( geometry_handle const &Geometry ) const -> bool {
auto valid( geometry_handle const &Geometry ) const -> bool {
return ( ( Geometry.bank != 0 )
&& ( Geometry.bank <= m_geometrybanks.size() ) ); }
inline
auto bank( geometry_handle const Geometry ) -> geometrybanktimepointpair_sequence::value_type & {
auto bank( geometry_handle const Geometry ) -> geometrybanktimepointpair_sequence::value_type & {
return m_geometrybanks[ Geometry.bank - 1 ]; }
inline
auto bank( geometry_handle const Geometry ) const -> geometrybanktimepointpair_sequence::value_type const & {
auto bank( geometry_handle const Geometry ) const -> geometrybanktimepointpair_sequence::value_type const & {
return m_geometrybanks[ Geometry.bank - 1 ]; }
// members:

View File

@@ -52,8 +52,7 @@ public:
Render() override { return true; }
void
SwapBuffers() override {}
inline
float
float
Framerate() override { return 10.0f; }
bool AddViewport(const global_settings::extraviewport_config &conf) override { return false; }
@@ -121,7 +120,7 @@ public:
Texture( texture_handle const Texture ) const override { throw std::runtime_error("not impl"); }
// utility methods
void
Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) override {}
Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) override {}
void
Pick_Node_Callback( std::function<void( scene::basic_node * )> Callback ) override {}
TSubModel const *

View File

@@ -52,10 +52,10 @@ private:
replace_( geometry_handle const &Geometry ) override;
// draw() subclass details
auto
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) -> std::size_t override;
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams ) -> std::size_t override;
// draw_instanced() subclass details — issues glDrawElementsInstancedBaseVertex
auto
draw_instanced_( geometry_handle const &Geometry, stream_units const &Units, std::size_t const InstanceCount, unsigned int const Streams ) -> std::size_t override;
draw_instanced_( geometry_handle const &Geometry, stream_units const &Units, std::size_t InstanceCount, unsigned int Streams ) -> std::size_t override;
// release() subclass details
void
release_() override;

View File

@@ -17,7 +17,7 @@ struct opengl33_light : public basic_light {
float factor;
void apply_intensity(float const Factor = 1.0f);
void apply_intensity(float Factor = 1.0f);
void apply_angle();
opengl33_light &operator=(basic_light const &Right) {

View File

@@ -28,7 +28,7 @@ public:
private:
// methods
void create( int const Tesselation );
void create( int Tesselation );
// members
std::vector<glm::vec3> m_vertices;
std::vector<glm::vec2> m_uvs;

View File

@@ -4920,7 +4920,7 @@ void opengl33_renderer::Update_Pick_Node()
}
}
void opengl33_renderer::Pick_Control_Callback(std::function<void(TSubModel const *, const glm::vec2 pos)> callback)
void opengl33_renderer::Pick_Control_Callback(std::function<void(TSubModel const *, glm::vec2 pos)> callback)
{
if (!Global.render_cab) {
callback(nullptr, glm::vec2());

View File

@@ -49,8 +49,7 @@ class opengl33_renderer : public gfx_renderer {
Render() override;
void
SwapBuffers() override;
inline
float
float
Framerate() override { return m_framerate; }
// geometry methods
// NOTE: hands-on geometry management is exposed as a temporary measure; ultimately all visualization data should be generated/handled automatically by the renderer itself
@@ -58,13 +57,13 @@ class opengl33_renderer : public gfx_renderer {
gfx::geometrybank_handle
Create_Bank() override;
// creates a new indexed geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) override;
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) override;
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type, const std::size_t Offset = 0) override;
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type, std::size_t Offset = 0) override;
// adds supplied vertex data at the end of specified chunk
bool Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type) override;
bool Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type) override;
// provides direct access to index data of specfied chunk
gfx::index_array const &
Indices( gfx::geometry_handle const &Geometry ) const override;
@@ -76,27 +75,27 @@ class opengl33_renderer : public gfx_renderer {
UserData( gfx::geometry_handle const &Geometry ) const override;
// material methods
material_handle
Fetch_Material( std::string const &Filename, bool const Loadnow = true ) override;
Fetch_Material( std::string const &Filename, bool Loadnow = true ) override;
void
Bind_Material( material_handle const Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override;
Bind_Material( material_handle Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override;
IMaterial const *
Material( material_handle const Material ) const override;
Material( material_handle Material ) const override;
// shader methods
auto Fetch_Shader( std::string const &name ) -> std::shared_ptr<gl::program> override;
// texture methods
texture_handle
Fetch_Texture( std::string const &Filename, bool const Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override;
Fetch_Texture( std::string const &Filename, bool Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override;
void
Bind_Texture( texture_handle const Texture ) override;
Bind_Texture( texture_handle Texture ) override;
void
Bind_Texture( std::size_t const Unit, texture_handle const Texture ) override;
Bind_Texture( std::size_t Unit, texture_handle Texture ) override;
ITexture &
Texture( texture_handle const Texture ) override;
Texture( texture_handle Texture ) override;
ITexture const &
Texture( texture_handle const Texture ) const override;
Texture( texture_handle Texture ) const override;
// utility methods
void
Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) override;
Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) override;
void
Pick_Node_Callback( std::function<void( scene::basic_node * )> Callback ) override;
TSubModel const *
@@ -113,7 +112,7 @@ class opengl33_renderer : public gfx_renderer {
Camera_Position() const override { return m_colorpass.pass_camera.position(); }
// maintenance methods
void
Update( double const Deltatime ) override;
Update( double Deltatime ) override;
bool
Debug_Ui_State(std::optional<bool>) override;
void
@@ -131,13 +130,13 @@ class opengl33_renderer : public gfx_renderer {
opengl_material & Material( material_handle const Material );
opengl_material & Material( material_handle Material );
opengl_material const & Material( TSubModel const * Submodel ) const;
// draws supplied geometry handles
void Draw_Geometry(std::vector<gfx::geometrybank_handle>::iterator begin, std::vector<gfx::geometrybank_handle>::iterator end);
void Draw_Geometry(const gfx::geometrybank_handle &handle);
// material methods
void Bind_Material_Shadow(material_handle const Material);
void Bind_Material_Shadow(material_handle Material);
void Update_AnimModel(TAnimModel *model);
// members
@@ -257,24 +256,24 @@ class opengl33_renderer : public gfx_renderer {
// methods
std::unique_ptr<gl::program> make_shader(std::string v, std::string f);
bool Init_caps();
void setup_pass(viewport_config &Viewport, renderpass_config &Config, rendermode const Mode, float const Znear = 0.f, float const Zfar = 1.f, bool const Ignoredebug = false);
void setup_pass(viewport_config &Viewport, renderpass_config &Config, rendermode Mode, float Znear = 0.f, float Zfar = 1.f, bool Ignoredebug = false);
void setup_matrices();
void setup_drawing(bool const Alpha = false);
void setup_drawing(bool Alpha = false);
void setup_shadow_unbind_map();
void setup_shadow_bind_map();
void setup_shadow_color( glm::vec4 const &Shadowcolor );
void setup_env_map(gl::cubemap *tex);
void setup_environment_light(TEnvironmentType const Environment = e_flat);
void setup_sunlight_intensity( float const Factor = 1.f);
void setup_environment_light(TEnvironmentType Environment = e_flat);
void setup_sunlight_intensity( float Factor = 1.f);
// runs jobs needed to generate graphics for specified render pass
void Render_pass(viewport_config &vp, rendermode const Mode);
void Render_pass(viewport_config &vp, rendermode Mode);
// creates dynamic environment cubemap
bool Render_reflections(viewport_config &vp);
bool Render(world_environment *Environment);
void Render(scene::basic_region *Region);
void Render(section_sequence::iterator First, section_sequence::iterator Last);
void Render(cell_sequence::iterator First, cell_sequence::iterator Last);
void Render(scene::shape_node const &Shape, bool const Ignorerange);
void Render(scene::shape_node const &Shape, bool Ignorerange);
void Render(TAnimModel *Instance);
// batched render path for many TAnimModel instances that share the same TModel3d.
// Caller guarantees every instance has m_instanceable == true (no per-instance lights,
@@ -283,8 +282,8 @@ class opengl33_renderer : public gfx_renderer {
// instances counter. Instances are still individually frustum/distance culled.
void Render_Instanced( TModel3d *Model, std::vector<TAnimModel *> const &Instances );
bool Render(TDynamicObject *Dynamic);
bool Render(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
bool Render(TModel3d *Model, material_data const *Material, float const Squaredistance);
bool Render(TModel3d *Model, material_data const *Material, float Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
bool Render(TModel3d *Model, material_data const *Material, float Squaredistance);
void Render(TSubModel *Submodel);
void Render(TTrack *Track);
void Render(scene::basic_cell::path_sequence::const_iterator First, scene::basic_cell::path_sequence::const_iterator Last);
@@ -293,10 +292,10 @@ class opengl33_renderer : public gfx_renderer {
// no-op if the track has no sleepermodel, Global.SleeperDistance is 0, or the camera is beyond
// Global.SleeperDistance from the track origin.
void Render_Sleepers( TTrack *Track );
bool Render_cab(TDynamicObject const *Dynamic, float const Lightlevel, bool const Alpha = false);
bool Render_interior( bool const Alpha = false );
bool Render_lowpoly( TDynamicObject *Dynamic, float const Squaredistance, bool const Setup, bool const Alpha = false );
bool Render_coupler_adapter( TDynamicObject *Dynamic, float const Squaredistance, int const End, bool const Alpha = false );
bool Render_cab(TDynamicObject const *Dynamic, float Lightlevel, bool Alpha = false);
bool Render_interior( bool Alpha = false );
bool Render_lowpoly( TDynamicObject *Dynamic, float Squaredistance, bool Setup, bool Alpha = false );
bool Render_coupler_adapter( TDynamicObject *Dynamic, float Squaredistance, int End, bool Alpha = false );
void Render(TMemCell *Memcell);
void Render_particles();
void Render_precipitation();
@@ -307,11 +306,11 @@ class opengl33_renderer : public gfx_renderer {
void Render_Alpha(TTraction *Traction);
void Render_Alpha(scene::lines_node const &Lines);
bool Render_Alpha(TDynamicObject *Dynamic);
bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance);
bool Render_Alpha(TModel3d *Model, material_data const *Material, float Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
bool Render_Alpha(TModel3d *Model, material_data const *Material, float Squaredistance);
void Render_Alpha(TSubModel *Submodel);
void Update_Lights(light_array &Lights);
glm::vec3 pick_color(std::size_t const Index);
glm::vec3 pick_color(std::size_t Index);
std::size_t pick_index(glm::ivec3 const &Color);
bool init_viewport(viewport_config &vp);

View File

@@ -19,11 +19,9 @@ public:
// constructors
opengl_camera() = default;
// methods:
inline
void
void
update_frustum() { update_frustum( m_projection, m_modelview ); }
inline
void
void
update_frustum(glm::mat4 frustumtest_proj) {
update_frustum(frustumtest_proj, m_modelview); }
void
@@ -32,26 +30,19 @@ public:
visible( scene::bounding_area const &Area ) const;
bool
visible( TDynamicObject const *Dynamic ) const;
inline
glm::dvec3 const &
glm::dvec3 const &
position() const { return m_position; }
inline
glm::dvec3 &
glm::dvec3 &
position() { return m_position; }
inline
glm::mat4 const &
glm::mat4 const &
projection() const { return m_projection; }
inline
glm::mat4 &
glm::mat4 &
projection() { return m_projection; }
inline
glm::mat4 const &
glm::mat4 const &
modelview() const { return m_modelview; }
inline
glm::mat4 &
glm::mat4 &
modelview() { return m_modelview; }
inline
std::vector<glm::vec4> &
std::vector<glm::vec4> &
frustum_points() { return m_frustumpoints; }
// transforms provided set of clip space points to world space
template <class Iterator_>

View File

@@ -19,39 +19,31 @@ public:
opengl_color() = default;
// methods:
inline
void
void
color3( glm::vec3 const &Color ) {
return color4( glm::vec4{ Color, 1.f } ); }
inline
void
void
color3( float const Red, float const Green, float const Blue ) {
return color3( glm::vec3 { Red, Green, Blue } ); }
inline
void
void
color3( float const *Value ) {
return color3( glm::make_vec3( Value ) ); }
inline
void
void
color4( glm::vec4 const &Color ) {
if( ( Color != m_color ) || ( false == Global.bUseVBO ) ) {
m_color = Color;
::glColor4fv( glm::value_ptr( m_color ) ); } }
inline
void
void
color4( float const Red, float const Green, float const Blue, float const Alpha ) {
return color4( glm::vec4{ Red, Green, Blue, Alpha } ); }
inline
void
void
color4( float const *Value ) {
return color4( glm::make_vec4( Value ) );
}
inline
glm::vec4 const &
glm::vec4 const &
data() const {
return m_color; }
inline
float const *
float const *
data_array() const {
return glm::value_ptr( m_color ); }

View File

@@ -51,7 +51,7 @@ private:
replace_( geometry_handle const &Geometry ) override;
// draw() subclass details
auto
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) -> std::size_t override;
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams ) -> std::size_t override;
// release() subclass details
void
release_() override;
@@ -63,7 +63,7 @@ private:
delete_buffer();
static
void
bind_streams(stream_units const &Units, unsigned int const Streams , size_t offset = 0);
bind_streams(stream_units const &Units, unsigned int Streams , size_t offset = 0);
static
void
release_streams();
@@ -109,7 +109,7 @@ private:
replace_( geometry_handle const &Geometry ) override;
// draw() subclass details
auto
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) -> std::size_t override;
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams ) -> std::size_t override;
// release () subclass details
void
release_() override;

View File

@@ -16,7 +16,7 @@ struct opengl_light : public basic_light {
GLuint id { (GLuint)-1 };
void
apply_intensity( float const Factor = 1.0f );
apply_intensity( float Factor = 1.0f );
void
apply_angle();

View File

@@ -24,7 +24,7 @@ public:
void
update( opengl_camera const &Camera );
std::size_t
render( GLint const Textureunit );
render( GLint Textureunit );
private:
// types
struct particle_vertex {

View File

@@ -22,11 +22,11 @@ public:
void
update();
void
render( GLint const Textureunit );
render( GLint Textureunit );
private:
// methods
void create( int const Tesselation );
void create( int Tesselation );
// members
std::vector<glm::vec3> m_vertices;
std::vector<glm::vec2> m_uvs;

View File

@@ -1831,7 +1831,7 @@ opengl_renderer::Texture( texture_handle const Texture ) const {
}
void
opengl_renderer::Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) {
opengl_renderer::Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) {
m_control_pick_requests.emplace_back( Callback );
}

View File

@@ -44,8 +44,7 @@ public:
Render() override;
void
SwapBuffers() override;
inline
float
float
Framerate() override { return m_framerate; }
bool AddViewport(const global_settings::extraviewport_config &conf) override { return false; }
@@ -58,13 +57,13 @@ public:
gfx::geometrybank_handle
Create_Bank() override;
// creates a new indexed geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) override;
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) override;
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type, const std::size_t Offset = 0) override;
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type, std::size_t Offset = 0) override;
// adds supplied vertex data at the end of specified chunk
bool Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type) override;
bool Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type) override;
// provides direct access to index data of specfied chunk
gfx::index_array const &
Indices( gfx::geometry_handle const &Geometry ) const override;
@@ -76,27 +75,27 @@ public:
UserData( gfx::geometry_handle const &Geometry ) const override;
// material methods
material_handle
Fetch_Material( std::string const &Filename, bool const Loadnow = true ) override;
Fetch_Material( std::string const &Filename, bool Loadnow = true ) override;
void
Bind_Material( material_handle const Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override;
Bind_Material( material_handle Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override;
IMaterial const *
Material( material_handle const Material ) const override;
Material( material_handle Material ) const override;
// shader methods
auto Fetch_Shader( std::string const &name ) -> std::shared_ptr<gl::program> override;
// texture methods
texture_handle
Fetch_Texture( std::string const &Filename, bool const Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override;
Fetch_Texture( std::string const &Filename, bool Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override;
void
Bind_Texture( texture_handle const Texture ) override;
Bind_Texture( texture_handle Texture ) override;
void
Bind_Texture( std::size_t const Unit, texture_handle const Texture ) override;
Bind_Texture( std::size_t Unit, texture_handle Texture ) override;
ITexture &
Texture( texture_handle const Texture ) override;
Texture( texture_handle Texture ) override;
ITexture const &
Texture( texture_handle const Texture ) const override;
Texture( texture_handle Texture ) const override;
// utility methods
void
Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) override;
Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) override;
void
Pick_Node_Callback( std::function<void( scene::basic_node * )> Callback ) override;
TSubModel const *
@@ -113,7 +112,7 @@ public:
Camera_Position() const override { return m_colorpass.camera.position(); }
// maintenance methods
void
Update( double const Deltatime ) override;
Update( double Deltatime ) override;
void
Update_Pick_Control() override;
void
@@ -190,27 +189,27 @@ private:
void
Disable_Lights();
void
setup_pass( renderpass_config &Config, rendermode const Mode, float const Znear = 0.f, float const Zfar = 1.f, bool const Ignoredebug = false );
setup_pass( renderpass_config &Config, rendermode Mode, float Znear = 0.f, float Zfar = 1.f, bool Ignoredebug = false );
void
setup_matrices();
void
setup_drawing( bool const Alpha = false );
setup_drawing( bool Alpha = false );
void
setup_units( bool const Diffuse, bool const Shadows, bool const Reflections );
setup_units( bool Diffuse, bool Shadows, bool Reflections );
void
setup_shadow_map( GLuint const Texture, glm::mat4 const &Transformation );
setup_shadow_map( GLuint Texture, glm::mat4 const &Transformation );
void
setup_shadow_color( glm::vec4 const &Shadowcolor );
void
setup_environment_light( TEnvironmentType const Environment = e_flat );
setup_environment_light( TEnvironmentType Environment = e_flat );
void
switch_units( bool const Diffuse, bool const Shadows, bool const Reflections );
switch_units( bool Diffuse, bool Shadows, bool Reflections );
// helper, texture manager method; activates specified texture unit
void
select_unit( GLint const Textureunit );
select_unit( GLint Textureunit );
// runs jobs needed to generate graphics for specified render pass
void
Render_pass( rendermode const Mode );
Render_pass( rendermode Mode );
// creates dynamic environment cubemap
bool
Render_reflections();
@@ -223,15 +222,15 @@ private:
void
Render( cell_sequence::iterator First, cell_sequence::iterator Last );
void
Render( scene::shape_node const &Shape, bool const Ignorerange );
Render( scene::shape_node const &Shape, bool Ignorerange );
void
Render( TAnimModel *Instance );
bool
Render( TDynamicObject *Dynamic );
bool
Render( TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
Render( TModel3d *Model, material_data const *Material, float Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
bool
Render( TModel3d *Model, material_data const *Material, float const Squaredistance );
Render( TModel3d *Model, material_data const *Material, float Squaredistance );
void
Render( TSubModel *Submodel );
void
@@ -239,13 +238,13 @@ private:
void
Render( scene::basic_cell::path_sequence::const_iterator First, scene::basic_cell::path_sequence::const_iterator Last );
bool
Render_cab( TDynamicObject const *Dynamic, float const Lightlevel, bool const Alpha = false );
Render_cab( TDynamicObject const *Dynamic, float Lightlevel, bool Alpha = false );
bool
Render_interior( bool const Alpha = false );
Render_interior( bool Alpha = false );
bool
Render_lowpoly( TDynamicObject *Dynamic, float const Squaredistance, bool const Setup, bool const Alpha = false );
Render_lowpoly( TDynamicObject *Dynamic, float Squaredistance, bool Setup, bool Alpha = false );
bool
Render_coupler_adapter( TDynamicObject *Dynamic, float const Squaredistance, int const End, bool const Alpha = false );
Render_coupler_adapter( TDynamicObject *Dynamic, float Squaredistance, int End, bool Alpha = false );
void
Render( TMemCell *Memcell );
void
@@ -265,9 +264,9 @@ private:
bool
Render_Alpha( TDynamicObject *Dynamic );
bool
Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
Render_Alpha( TModel3d *Model, material_data const *Material, float Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
bool
Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance );
Render_Alpha( TModel3d *Model, material_data const *Material, float Squaredistance );
void
Render_Alpha( TSubModel *Submodel );
void
@@ -275,7 +274,7 @@ private:
bool
Init_caps();
glm::vec3
pick_color( std::size_t const Index );
pick_color( std::size_t Index );
std::size_t
pick_index( glm::ivec3 const &Color );
@@ -367,7 +366,7 @@ private:
std::vector<scene::basic_node *> m_picksceneryitems;
scene::basic_node *m_picksceneryitem { nullptr };
glm::vec3 m_worldmousecoordinates { 0.f };
std::vector<std::function<void( TSubModel const *, const glm::vec2 )>> m_control_pick_requests;
std::vector<std::function<void( TSubModel const *, glm::vec2 )>> m_control_pick_requests;
std::vector<std::function<void( scene::basic_node * )>> m_node_pick_requests;
#ifdef EU07_USE_DEBUG_CAMERA
renderpass_config m_worldcamera; // debug item

View File

@@ -47,7 +47,7 @@ public:
deserialize( cParser &Input );
// updates state of provided variable
void
update( Type_ &Variable, double const Timedelta ) const;
update( Type_ &Variable, double Timedelta ) const;
void
bind( Type_ const *Modifier ) {
m_valuechangemodifier = Modifier; }
@@ -92,7 +92,7 @@ public:
bind( TAnimModel const *Node );
// updates state of owned particles
void
update( double const Timedelta, bool const Onlydespawn );
update( double Timedelta, bool Onlydespawn );
glm::vec3 const &
color() const {
return m_emitter.color; }
@@ -135,7 +135,7 @@ private:
initialize( smoke_particle &Particle );
// updates state of provided particle and bounding box. returns: true if particle is still alive afterwards, false otherwise
bool
update( smoke_particle &Particle, bounding_box &Boundingbox, double const Timedelta );
update( smoke_particle &Particle, bounding_box &Boundingbox, double Timedelta );
// members
// config/inputs
// TBD: union and indicator, or just plain owner variables?
@@ -176,11 +176,11 @@ public:
// methods
// adds a new particle source of specified type, placing it in specified world location. returns: true on success, false if the specified type definition couldn't be located
bool
insert( std::string const &Sourcetemplate, glm::dvec3 const Location );
insert( std::string const &Sourcetemplate, glm::dvec3 Location );
bool
insert( std::string const &Sourcetemplate, TDynamicObject const *Vehicle, glm::dvec3 const Location );
insert( std::string const &Sourcetemplate, TDynamicObject const *Vehicle, glm::dvec3 Location );
bool
insert( std::string const &Sourcetemplate, TAnimModel const *Node, glm::dvec3 const Location );
insert( std::string const &Sourcetemplate, TAnimModel const *Node, glm::dvec3 Location );
// updates state of all owned emitters
void
update();

View File

@@ -41,13 +41,13 @@ public:
// creates a new geometry bank. returns: handle to the bank or NULL
virtual auto Create_Bank() -> gfx::geometrybank_handle = 0;
// creates a new indexed geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
virtual auto Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) -> gfx::geometry_handle = 0;
virtual auto Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) -> gfx::geometry_handle = 0;
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
virtual auto Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) -> gfx::geometry_handle = 0;
virtual auto Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) -> gfx::geometry_handle = 0;
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
virtual auto Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type, const std::size_t Offset = 0) -> bool = 0;
virtual auto Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type, std::size_t Offset = 0) -> bool = 0;
// adds supplied vertex data at the end of specified chunk
virtual auto Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type) -> bool = 0;
virtual auto Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type) -> bool = 0;
// provides direct access to index data of specfied chunk
virtual auto Indices( gfx::geometry_handle const &Geometry ) const->gfx::index_array const & = 0;
// provides direct access to vertex data of specfied chunk
@@ -55,19 +55,19 @@ public:
// provides direct access to vertex user data of specfied chunk
virtual auto UserData( gfx::geometry_handle const &Geometry ) const ->gfx::userdata_array const & = 0;
// material methods
virtual auto Fetch_Material( std::string const &Filename, bool const Loadnow = true ) -> material_handle = 0;
virtual void Bind_Material( material_handle const Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) = 0;
virtual auto Material( material_handle const Material ) const -> IMaterial const * = 0;
virtual auto Fetch_Material( std::string const &Filename, bool Loadnow = true ) -> material_handle = 0;
virtual void Bind_Material( material_handle Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) = 0;
virtual auto Material( material_handle Material ) const -> IMaterial const * = 0;
// shader methods
virtual auto Fetch_Shader( std::string const &name ) -> std::shared_ptr<gl::program> = 0;
// texture methods
virtual auto Fetch_Texture( std::string const &Filename, bool const Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) -> texture_handle = 0;
virtual void Bind_Texture( texture_handle const Texture ) = 0;
virtual void Bind_Texture( std::size_t const Unit, texture_handle const Texture ) = 0;
virtual auto Texture( texture_handle const Texture ) -> ITexture & = 0;
virtual auto Texture( texture_handle const Texture ) const -> ITexture const & = 0;
virtual auto Fetch_Texture( std::string const &Filename, bool Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) -> texture_handle = 0;
virtual void Bind_Texture( texture_handle Texture ) = 0;
virtual void Bind_Texture( std::size_t Unit, texture_handle Texture ) = 0;
virtual auto Texture( texture_handle Texture ) -> ITexture & = 0;
virtual auto Texture( texture_handle Texture ) const -> ITexture const & = 0;
// utility methods
virtual void Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) = 0;
virtual void Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) = 0;
virtual void Pick_Node_Callback( std::function<void( scene::basic_node * )> Callback ) = 0;
virtual auto Pick_Control() const -> TSubModel const * = 0;
virtual auto Pick_Node() const -> scene::basic_node const * = 0;
@@ -81,7 +81,7 @@ public:
virtual auto Camera_Projection_Matrix() const -> glm::mat4 { return glm::mat4( 1.f ); }
virtual auto Camera_Position() const -> glm::dvec3 { return glm::dvec3( 0.0 ); }
// maintenance methods
virtual void Update( double const Deltatime ) = 0;
virtual void Update( double Deltatime ) = 0;
virtual void Update_Pick_Control() = 0;
virtual void Update_Pick_Node() = 0;
virtual auto Update_Mouse_Position() -> glm::dvec3 = 0;