mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
files missing from previous commit
fixes version
This commit is contained in:
17
Segment.cpp
17
Segment.cpp
@@ -16,23 +16,6 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "Track.h"
|
#include "Track.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// helper, restores content of a 3d vector from provided input stream
|
|
||||||
// TODO: review and clean up the helper routines, there's likely some redundant ones
|
|
||||||
Math3D::vector3 LoadPoint( cParser &Input ) {
|
|
||||||
// pobranie współrzędnych punktu
|
|
||||||
Input.getTokens( 3 );
|
|
||||||
Math3D::vector3 point;
|
|
||||||
Input
|
|
||||||
>> point.x
|
|
||||||
>> point.y
|
|
||||||
>> point.z;
|
|
||||||
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
segment_data::deserialize( cParser &Input, Math3D::vector3 const &Offset ) {
|
segment_data::deserialize( cParser &Input, Math3D::vector3 const &Offset ) {
|
||||||
|
|
||||||
|
|||||||
12
Traction.cpp
12
Traction.cpp
@@ -19,6 +19,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Logs.h"
|
#include "Logs.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@@ -93,17 +94,6 @@ sekcji z sąsiedniego przęsła).
|
|||||||
|
|
||||||
TTraction::TTraction( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
TTraction::TTraction( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||||
|
|
||||||
glm::dvec3 LoadPoint( cParser &Input ) {
|
|
||||||
// pobranie współrzędnych punktu
|
|
||||||
glm::dvec3 point;
|
|
||||||
Input.getTokens( 3 );
|
|
||||||
Input
|
|
||||||
>> point.x
|
|
||||||
>> point.y
|
|
||||||
>> point.z;
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TTraction::Load( cParser *parser, glm::dvec3 const &pOrigin ) {
|
TTraction::Load( cParser *parser, glm::dvec3 const &pOrigin ) {
|
||||||
|
|
||||||
|
|||||||
16
renderer.cpp
16
renderer.cpp
@@ -841,14 +841,20 @@ opengl_renderer::setup_pass( renderpass_config &Config, rendermode const Mode, f
|
|||||||
auto const zfar = Config.draw_range * Global.fDistanceFactor * Zfar;
|
auto const zfar = Config.draw_range * Global.fDistanceFactor * Zfar;
|
||||||
auto const znear = (
|
auto const znear = (
|
||||||
Znear > 0.f ?
|
Znear > 0.f ?
|
||||||
Znear * zfar :
|
Znear * zfar :
|
||||||
0.1f * Global.ZoomFactor );
|
0.1f * Global.ZoomFactor );
|
||||||
camera.projection() *=
|
camera.projection() *=
|
||||||
glm::perspective(
|
glm::perspective(
|
||||||
glm::radians( Global.FieldOfView / Global.ZoomFactor ),
|
glm::radians( Global.FieldOfView / Global.ZoomFactor ),
|
||||||
std::max( 1.f, (float)Global.iWindowWidth ) / std::max( 1.f, (float)Global.iWindowHeight ),
|
std::max( 1.f, (float)Global.iWindowWidth ) / std::max( 1.f, (float)Global.iWindowHeight ),
|
||||||
znear,
|
znear,
|
||||||
zfar );
|
zfar );
|
||||||
|
/*
|
||||||
|
m_sunandviewangle =
|
||||||
|
glm::dot(
|
||||||
|
m_sunlight.direction,
|
||||||
|
glm::vec3( 0.f, 0.f, -1.f ) * glm::mat3( viewmatrix ) );
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case rendermode::shadows: {
|
case rendermode::shadows: {
|
||||||
@@ -2985,7 +2991,7 @@ opengl_renderer::Render_Alpha( TTraction *Traction ) {
|
|||||||
::glColor4fv(
|
::glColor4fv(
|
||||||
glm::value_ptr(
|
glm::value_ptr(
|
||||||
glm::vec4{
|
glm::vec4{
|
||||||
Traction->wire_color(),
|
Traction->wire_color() /* * ( DebugModeFlag ? 1.f : clamp( m_sunandviewangle, 0.25f, 1.f ) ) */,
|
||||||
linealpha } ) );
|
linealpha } ) );
|
||||||
// render
|
// render
|
||||||
m_geometry.draw( Traction->m_geometry );
|
m_geometry.draw( Traction->m_geometry );
|
||||||
@@ -3442,7 +3448,7 @@ opengl_renderer::Update_Pick_Control() {
|
|||||||
return control;
|
return control;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor::basic_node const *
|
scene::basic_node const *
|
||||||
opengl_renderer::Update_Pick_Node() {
|
opengl_renderer::Update_Pick_Node() {
|
||||||
|
|
||||||
#ifdef EU07_USE_PICKING_FRAMEBUFFER
|
#ifdef EU07_USE_PICKING_FRAMEBUFFER
|
||||||
@@ -3477,7 +3483,7 @@ opengl_renderer::Update_Pick_Node() {
|
|||||||
unsigned char pickreadout[4];
|
unsigned char pickreadout[4];
|
||||||
::glReadPixels( pickbufferpos.x, pickbufferpos.y, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, pickreadout );
|
::glReadPixels( pickbufferpos.x, pickbufferpos.y, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, pickreadout );
|
||||||
auto const nodeindex = pick_index( glm::ivec3{ pickreadout[ 2 ], pickreadout[ 1 ], pickreadout[ 0 ] } );
|
auto const nodeindex = pick_index( glm::ivec3{ pickreadout[ 2 ], pickreadout[ 1 ], pickreadout[ 0 ] } );
|
||||||
editor::basic_node const *node { nullptr };
|
scene::basic_node const *node { nullptr };
|
||||||
if( ( nodeindex > 0 )
|
if( ( nodeindex > 0 )
|
||||||
&& ( nodeindex <= m_picksceneryitems.size() ) ) {
|
&& ( nodeindex <= m_picksceneryitems.size() ) ) {
|
||||||
node = m_picksceneryitems[ nodeindex - 1 ];
|
node = m_picksceneryitems[ nodeindex - 1 ];
|
||||||
|
|||||||
12
renderer.h
12
renderer.h
@@ -163,14 +163,14 @@ public:
|
|||||||
// utility methods
|
// utility methods
|
||||||
TSubModel const *
|
TSubModel const *
|
||||||
Pick_Control() const { return m_pickcontrolitem; }
|
Pick_Control() const { return m_pickcontrolitem; }
|
||||||
editor::basic_node const *
|
scene::basic_node const *
|
||||||
Pick_Node() const { return m_picksceneryitem; }
|
Pick_Node() const { return m_picksceneryitem; }
|
||||||
// maintenance methods
|
// maintenance methods
|
||||||
void
|
void
|
||||||
Update( double const Deltatime );
|
Update( double const Deltatime );
|
||||||
TSubModel const *
|
TSubModel const *
|
||||||
Update_Pick_Control();
|
Update_Pick_Control();
|
||||||
editor::basic_node const *
|
scene::basic_node const *
|
||||||
Update_Pick_Node();
|
Update_Pick_Node();
|
||||||
// debug methods
|
// debug methods
|
||||||
std::string const &
|
std::string const &
|
||||||
@@ -320,7 +320,9 @@ private:
|
|||||||
texture_manager m_textures;
|
texture_manager m_textures;
|
||||||
opengl_light m_sunlight;
|
opengl_light m_sunlight;
|
||||||
opengllight_array m_lights;
|
opengllight_array m_lights;
|
||||||
|
/*
|
||||||
|
float m_sunandviewangle; // cached dot product of sunlight and camera vectors
|
||||||
|
*/
|
||||||
gfx::geometry_handle m_billboardgeometry { 0, 0 };
|
gfx::geometry_handle m_billboardgeometry { 0, 0 };
|
||||||
texture_handle m_glaretexture { -1 };
|
texture_handle m_glaretexture { -1 };
|
||||||
texture_handle m_suntexture { -1 };
|
texture_handle m_suntexture { -1 };
|
||||||
@@ -386,8 +388,8 @@ private:
|
|||||||
renderpass_config m_cabshadowpass; // parameters of most recent cab shadowmap pass
|
renderpass_config m_cabshadowpass; // parameters of most recent cab shadowmap pass
|
||||||
std::vector<TSubModel const *> m_pickcontrolsitems;
|
std::vector<TSubModel const *> m_pickcontrolsitems;
|
||||||
TSubModel const *m_pickcontrolitem { nullptr };
|
TSubModel const *m_pickcontrolitem { nullptr };
|
||||||
std::vector<editor::basic_node const *> m_picksceneryitems;
|
std::vector<scene::basic_node const *> m_picksceneryitems;
|
||||||
editor::basic_node const *m_picksceneryitem { nullptr };
|
scene::basic_node const *m_picksceneryitem { nullptr };
|
||||||
#ifdef EU07_USE_DEBUG_CAMERA
|
#ifdef EU07_USE_DEBUG_CAMERA
|
||||||
renderpass_config m_worldcamera; // debug item
|
renderpass_config m_worldcamera; // debug item
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "skydome.h"
|
#include "skydome.h"
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
// sky gradient based on "A practical analytic model for daylight"
|
// sky gradient based on "A practical analytic model for daylight"
|
||||||
// by A. J. Preetham Peter Shirley Brian Smits (University of Utah)
|
// by A. J. Preetham Peter Shirley Brian Smits (University of Utah)
|
||||||
|
|||||||
1
stdafx.h
1
stdafx.h
@@ -90,6 +90,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GLM_ENABLE_EXPERIMENTAL
|
#define GLM_ENABLE_EXPERIMENTAL
|
||||||
|
#define GLM_FORCE_CTOR_INIT
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <glm/gtc/matrix_access.hpp>
|
#include <glm/gtc/matrix_access.hpp>
|
||||||
|
|||||||
@@ -973,7 +973,7 @@ ui_layer::render() {
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glPushAttrib( GL_ENABLE_BIT | GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT ); // blendfunc included since 3rd party gui doesn't play nice
|
glPushAttrib( GL_ENABLE_BIT | GL_CURRENT_BIT);// | GL_COLOR_BUFFER_BIT ); // blendfunc included since 3rd party gui doesn't play nice
|
||||||
glDisable( GL_LIGHTING );
|
glDisable( GL_LIGHTING );
|
||||||
glDisable( GL_DEPTH_TEST );
|
glDisable( GL_DEPTH_TEST );
|
||||||
glDisable( GL_ALPHA_TEST );
|
glDisable( GL_ALPHA_TEST );
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Copyright (C) 2007-2014 Maciej Cierniak
|
|||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
bool DebugModeFlag = false;
|
bool DebugModeFlag = false;
|
||||||
bool FreeFlyModeFlag = false;
|
bool FreeFlyModeFlag = false;
|
||||||
@@ -387,3 +388,17 @@ substr_path( std::string const &Filename ) {
|
|||||||
Filename.substr( 0, Filename.rfind( '/' ) + 1 ) :
|
Filename.substr( 0, Filename.rfind( '/' ) + 1 ) :
|
||||||
"" );
|
"" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper, restores content of a 3d vector from provided input stream
|
||||||
|
// TODO: review and clean up the helper routines, there's likely some redundant ones
|
||||||
|
|
||||||
|
glm::dvec3 LoadPoint( cParser &Input ) {
|
||||||
|
// pobranie współrzędnych punktu
|
||||||
|
glm::dvec3 point;
|
||||||
|
Input.getTokens( 3 );
|
||||||
|
Input
|
||||||
|
>> point.x
|
||||||
|
>> point.y
|
||||||
|
>> point.z;
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include "dumb3d.h"
|
||||||
|
|
||||||
/*rozne takie duperele do operacji na stringach w paszczalu, pewnie w delfi sa lepsze*/
|
/*rozne takie duperele do operacji na stringach w paszczalu, pewnie w delfi sa lepsze*/
|
||||||
/*konwersja zmiennych na stringi, funkcje matematyczne, logiczne, lancuchowe, I/O etc*/
|
/*konwersja zmiennych na stringi, funkcje matematyczne, logiczne, lancuchowe, I/O etc*/
|
||||||
@@ -300,4 +301,5 @@ nearest_segment_point( VecType_ const &Segmentstart, VecType_ const &Segmentend,
|
|||||||
return c1 / c2;
|
return c1 / c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
class cParser;
|
||||||
|
glm::dvec3 LoadPoint( cParser &Input );
|
||||||
|
|||||||
Reference in New Issue
Block a user