mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
maintenance: minor code cleanup
This commit is contained in:
@@ -413,14 +413,6 @@ TAnimModel::TAnimModel( scene::node_data const &Nodedata ) : basic_node( Nodedat
|
||||
}
|
||||
}
|
||||
|
||||
TAnimModel::TAnimModel() {
|
||||
// TODO: wrap these in a tuple and move to underlying model
|
||||
for( int index = 0; index < iMaxNumLights; ++index ) {
|
||||
LightsOn[index] = LightsOff[index] = nullptr; // normalnie nie ma
|
||||
lsLights[index] = ls_Off; // a jeśli są, to wyłączone
|
||||
}
|
||||
}
|
||||
|
||||
TAnimModel::~TAnimModel()
|
||||
{
|
||||
delete pAdvanced; // nie ma zaawansowanej animacji
|
||||
|
||||
@@ -126,7 +126,6 @@ class TAnimModel : public editor::basic_node {
|
||||
public:
|
||||
// constructors
|
||||
TAnimModel( scene::node_data const &Nodedata );
|
||||
TAnimModel();
|
||||
// destructor
|
||||
~TAnimModel();
|
||||
// methods
|
||||
|
||||
10
MemCell.cpp
10
MemCell.cpp
@@ -21,16 +21,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// legacy constructor
|
||||
TMemCell::TMemCell(vector3 *p)
|
||||
{
|
||||
fValue1 = fValue2 = 0;
|
||||
location(
|
||||
p ? *p : glm::dvec3() ); // ustawienie współrzędnych, bo do TGroundNode nie ma dostępu
|
||||
bCommand = false; // komenda wysłana
|
||||
OnSent = NULL;
|
||||
}
|
||||
|
||||
TMemCell::TMemCell( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||
|
||||
void TMemCell::UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask )
|
||||
|
||||
@@ -20,8 +20,6 @@ public:
|
||||
std::string asTrackName; // McZapkie-100302 - zeby nazwe toru na ktory jest Putcommand wysylane pamietac
|
||||
|
||||
TMemCell( scene::node_data const &Nodedata );
|
||||
// legacy constructor
|
||||
TMemCell( Math3D::vector3 *p );
|
||||
|
||||
void
|
||||
UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
|
||||
|
||||
16
Track.cpp
16
Track.cpp
@@ -130,12 +130,6 @@ void TIsolated::Modify(int i, TDynamicObject *o)
|
||||
// tworzenie nowego odcinka ruchu
|
||||
TTrack::TTrack( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||
|
||||
// legacy constructor
|
||||
TTrack::TTrack( std::string Name ) {
|
||||
|
||||
m_name = Name;
|
||||
}
|
||||
|
||||
TTrack::~TTrack()
|
||||
{ // likwidacja odcinka
|
||||
if( eType == tt_Cross ) {
|
||||
@@ -175,7 +169,9 @@ TTrack::sort_by_material( TTrack const *Left, TTrack const *Right ) {
|
||||
|
||||
TTrack * TTrack::Create400m(int what, double dx)
|
||||
{ // tworzenie toru do wstawiania taboru podczas konwersji na E3D
|
||||
auto *trk = new TTrack( "auto_400m" );
|
||||
scene::node_data nodedata;
|
||||
nodedata.name = "auto_400m"; // track isn't visible so only name is needed
|
||||
auto *trk = new TTrack( nodedata );
|
||||
trk->m_visible = false; // nie potrzeba pokazywać, zresztą i tak nie ma tekstur
|
||||
trk->iCategoryFlag = what; // taki sam typ plus informacja, że dodatkowy
|
||||
trk->Init(); // utworzenie segmentu
|
||||
@@ -191,7 +187,9 @@ TTrack * TTrack::NullCreate(int dir)
|
||||
TTrack
|
||||
*trk { nullptr },
|
||||
*trk2 { nullptr };
|
||||
trk = new TTrack( "auto_null" );
|
||||
scene::node_data nodedata;
|
||||
nodedata.name = "auto_null"; // track isn't visible so only name is needed
|
||||
trk = new TTrack( nodedata );
|
||||
trk->m_visible = false; // nie potrzeba pokazywać, zresztą i tak nie ma tekstur
|
||||
trk->iCategoryFlag = (iCategoryFlag & 15) | 0x80; // taki sam typ plus informacja, że dodatkowy
|
||||
float r1, r2;
|
||||
@@ -234,7 +232,7 @@ TTrack * TTrack::NullCreate(int dir)
|
||||
trk->fVelocity = 20.0; // zawracanie powoli
|
||||
trk->fRadius = 20.0; // promień, aby się dodawało do tabelki prędkości i liczyło narastająco
|
||||
trk->Init(); // utworzenie segmentu
|
||||
trk2 = new TTrack( "auto_null" );
|
||||
trk2 = new TTrack( nodedata );
|
||||
trk2->iCategoryFlag =
|
||||
(iCategoryFlag & 15) | 0x80; // taki sam typ plus informacja, że dodatkowy
|
||||
trk2->m_visible = false;
|
||||
|
||||
2
Track.h
2
Track.h
@@ -185,8 +185,6 @@ public:
|
||||
TGroundNode *nFouling[ 2 ] = { nullptr, nullptr }; // współrzędne ukresu albo oporu kozła
|
||||
|
||||
TTrack( scene::node_data const &Nodedata );
|
||||
// legacy constructor
|
||||
TTrack( std::string Name );
|
||||
virtual ~TTrack();
|
||||
|
||||
void Init();
|
||||
|
||||
@@ -91,11 +91,6 @@ sekcji z sąsiedniego przęsła).
|
||||
*/
|
||||
|
||||
TTraction::TTraction( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||
// legacy constructor
|
||||
TTraction::TTraction( std::string Name ) {
|
||||
|
||||
m_name = Name;
|
||||
}
|
||||
|
||||
glm::dvec3 LoadPoint( cParser &Input ) {
|
||||
// pobranie współrzędnych punktu
|
||||
|
||||
@@ -53,8 +53,6 @@ class TTraction : public editor::basic_node {
|
||||
geometry_handle m_geometry;
|
||||
|
||||
TTraction( scene::node_data const &Nodedata );
|
||||
// legacy constructor
|
||||
TTraction( std::string Name );
|
||||
|
||||
void Load( cParser *parser, glm::dvec3 const &pOrigin );
|
||||
// set origin point
|
||||
|
||||
@@ -22,10 +22,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
TTractionPowerSource::TTractionPowerSource( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||
// legacy constructor
|
||||
TTractionPowerSource::TTractionPowerSource( std::string Name ) {
|
||||
|
||||
m_name = Name;
|
||||
}
|
||||
|
||||
void TTractionPowerSource::Init(double const u, double const i)
|
||||
{ // ustawianie zasilacza przy braku w scenerii
|
||||
|
||||
@@ -40,8 +40,6 @@ public:
|
||||
bool bSection = false; // czy jest sekcją
|
||||
|
||||
TTractionPowerSource( scene::node_data const &Nodedata );
|
||||
// legacy constructor
|
||||
TTractionPowerSource( std::string Name );
|
||||
|
||||
void Init(double const u, double const i);
|
||||
bool Load(cParser *parser);
|
||||
|
||||
164
scenenode.h
164
scenenode.h
@@ -29,12 +29,14 @@ bool
|
||||
operator==( lighting_data const &Left, lighting_data const &Right ) {
|
||||
return ( ( Left.diffuse == Right.diffuse )
|
||||
&& ( Left.ambient == Right.ambient )
|
||||
&& ( Left.specular == Right.specular ) ); }
|
||||
&& ( Left.specular == Right.specular ) );
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
operator!=( lighting_data const &Left, lighting_data const &Right ) {
|
||||
return !( Left == Right ); }
|
||||
return !( Left == Right );
|
||||
}
|
||||
|
||||
namespace scene {
|
||||
|
||||
@@ -49,26 +51,6 @@ struct bounding_area {
|
||||
radius( Radius )
|
||||
{}
|
||||
};
|
||||
/*
|
||||
enum nodetype {
|
||||
|
||||
unknown,
|
||||
model,
|
||||
triangles,
|
||||
lines,
|
||||
dynamic,
|
||||
track,
|
||||
traction,
|
||||
powersource,
|
||||
sound,
|
||||
memorycell,
|
||||
eventlauncher
|
||||
};
|
||||
|
||||
class node_manager {
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
struct node_data {
|
||||
|
||||
@@ -119,16 +101,13 @@ public:
|
||||
compute_radius();
|
||||
// set visibility
|
||||
void
|
||||
visible( bool State ) {
|
||||
m_data.visible = State; }
|
||||
visible( bool State );
|
||||
// set origin point
|
||||
void
|
||||
origin( glm::dvec3 Origin ) {
|
||||
m_data.origin = Origin; }
|
||||
origin( glm::dvec3 Origin );
|
||||
// data access
|
||||
shapenode_data const &
|
||||
data() const {
|
||||
return m_data; }
|
||||
data() const;
|
||||
|
||||
private:
|
||||
// members
|
||||
@@ -136,6 +115,27 @@ private:
|
||||
shapenode_data m_data;
|
||||
};
|
||||
|
||||
// set visibility
|
||||
inline
|
||||
void
|
||||
shape_node::visible( bool State ) {
|
||||
m_data.visible = State;
|
||||
}
|
||||
// set origin point
|
||||
inline
|
||||
void
|
||||
shape_node::origin( glm::dvec3 Origin ) {
|
||||
m_data.origin = Origin;
|
||||
}
|
||||
// data access
|
||||
inline
|
||||
shape_node::shapenode_data const &
|
||||
shape_node::data() const {
|
||||
return m_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// holds a group of untextured lines
|
||||
class lines_node {
|
||||
|
||||
@@ -173,16 +173,13 @@ public:
|
||||
compute_radius();
|
||||
// set visibility
|
||||
void
|
||||
visible( bool State ) {
|
||||
m_data.visible = State; }
|
||||
visible( bool State );
|
||||
// set origin point
|
||||
void
|
||||
origin( glm::dvec3 Origin ) {
|
||||
m_data.origin = Origin; }
|
||||
origin( glm::dvec3 Origin );
|
||||
// data access
|
||||
linesnode_data const &
|
||||
data() const {
|
||||
return m_data; }
|
||||
data() const;
|
||||
|
||||
private:
|
||||
// members
|
||||
@@ -190,6 +187,26 @@ private:
|
||||
linesnode_data m_data;
|
||||
};
|
||||
|
||||
// set visibility
|
||||
inline
|
||||
void
|
||||
lines_node::visible( bool State ) {
|
||||
m_data.visible = State;
|
||||
}
|
||||
// set origin point
|
||||
inline
|
||||
void
|
||||
lines_node::origin( glm::dvec3 Origin ) {
|
||||
m_data.origin = Origin;
|
||||
}
|
||||
// data access
|
||||
inline
|
||||
lines_node::linesnode_data const &
|
||||
lines_node::data() const {
|
||||
return m_data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// holds geometry for specific piece of track/road/waterway
|
||||
class path_node {
|
||||
@@ -238,39 +255,10 @@ private:
|
||||
TTrack * m_path;
|
||||
};
|
||||
*/
|
||||
/*
|
||||
// holds reference to memory cell
|
||||
class memorycell_node {
|
||||
|
||||
friend class basic_region; // region might want to modify node content when it's being inserted
|
||||
|
||||
public:
|
||||
// types
|
||||
struct memorynode_data {
|
||||
// placement and visibility
|
||||
bounding_area area; // bounding area, in world coordinates
|
||||
bool visible { false }; // visibility flag
|
||||
};
|
||||
// methods
|
||||
// restores content of the node from provded input stream
|
||||
// TODO: implement
|
||||
memory_node &
|
||||
deserialize( cParser &Input, node_data const &Nodedata );
|
||||
void
|
||||
cell( TMemCell *Cell ) {
|
||||
m_memorycell = Cell; }
|
||||
TMemCell *
|
||||
cell() {
|
||||
return m_memorycell; }
|
||||
|
||||
private:
|
||||
// members
|
||||
memorynode_data m_data;
|
||||
TMemCell * m_memorycell;
|
||||
};
|
||||
*/
|
||||
} // scene
|
||||
|
||||
|
||||
|
||||
namespace editor {
|
||||
|
||||
// base interface for nodes which can be actvated in scenario editor
|
||||
@@ -278,28 +266,22 @@ struct basic_node {
|
||||
|
||||
public:
|
||||
// constructor
|
||||
basic_node() = default; // TODO: remove after refactor
|
||||
basic_node( scene::node_data const &Nodedata );
|
||||
// destructor
|
||||
virtual ~basic_node() = default;
|
||||
// methods
|
||||
std::string const &
|
||||
name() const {
|
||||
return m_name; }
|
||||
name() const;
|
||||
void
|
||||
location( glm::dvec3 const Location ) {
|
||||
m_area.center = Location; }
|
||||
location( glm::dvec3 const Location );
|
||||
glm::dvec3 const &
|
||||
location() const {
|
||||
return m_area.center; };
|
||||
location() const;
|
||||
float const &
|
||||
radius();
|
||||
void
|
||||
visible( bool const Visible ) {
|
||||
m_visible = Visible; }
|
||||
visible( bool const Visible );
|
||||
bool
|
||||
visible() const {
|
||||
return m_visible; }
|
||||
visible() const;
|
||||
|
||||
protected:
|
||||
// methods
|
||||
@@ -313,6 +295,36 @@ protected:
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
inline
|
||||
std::string const &
|
||||
basic_node::name() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
basic_node::location( glm::dvec3 const Location ) {
|
||||
m_area.center = Location;
|
||||
}
|
||||
|
||||
inline
|
||||
glm::dvec3 const &
|
||||
basic_node::location() const {
|
||||
return m_area.center;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
basic_node::visible( bool const Visible ) {
|
||||
m_visible = Visible;
|
||||
}
|
||||
|
||||
inline
|
||||
bool
|
||||
basic_node::visible() const {
|
||||
return m_visible;
|
||||
}
|
||||
|
||||
} // editor
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user