Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ani2 #53

Open
wants to merge 7 commits into
base: v1.5.1-RC4
Choose a base branch
from
Open

Ani2 #53

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ add_subdirectory (network)
add_subdirectory (simulator)

add_subdirectory (viewer)
#add_subdirectory(viewer2)
# add_subdirectory (viewer2)

add_subdirectory (addons/passcar)
add_subdirectory (addons/freightcar)
Expand Down
2 changes: 1 addition & 1 deletion viewer/display/include/display-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

#include "vehicle-signals.h"

typedef std::array<float, MAX_ANALOG_SIGNALS> display_signals_t;
using display_signals_t = std::array<float, MAX_ANALOG_SIGNALS>;

#endif // DISPLAY_TYPES_H
2 changes: 1 addition & 1 deletion viewer/display/include/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class DISPLAY_EXPORT AbstractDisplay : public QWidget
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
typedef AbstractDisplay* (*GetDisplay)();
using GetDisplay = AbstractDisplay* (*)();

//------------------------------------------------------------------------------
//
Expand Down
2 changes: 1 addition & 1 deletion viewer/osgdb_dmd/include/dmd-mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <osg/Array>
#include <osg/Drawable>

typedef std::vector<unsigned int> face_t;
using face_t = std::vector<unsigned int>;

//------------------------------------------------------------------------------
//
Expand Down
2 changes: 1 addition & 1 deletion viewer/osgdb_dmd/include/dmd-writer-visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <osg/NodeVisitor>
#include <osg/Geometry>

typedef std::vector<std::string> dmd_content_t;
using dmd_content_t = std::vector<std::string>;

//------------------------------------------------------------------------------
//
Expand Down
14 changes: 7 additions & 7 deletions viewer/osgdb_dmd/src/dmd-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void readNextMesh(std::ifstream &stream, dmd_multimesh_t &multimesh)
line = getLine(stream);

// Читаем массив вершин
mesh.vertices = new osg::Vec3Array;
mesh.vertices = new osg::Vec3Array;

for (unsigned int i = 0; i < mesh.vertex_count; ++i)
{
Expand All @@ -97,7 +97,7 @@ void readNextMesh(std::ifstream &stream, dmd_multimesh_t &multimesh)
for (unsigned int i = 0; i < mesh.faces_count; ++i)
{
line = getLine(stream);
line = delete_symbol(line, '\t');
line = delete_symbol(line, '\t');

std::istringstream ss(line);

Expand Down Expand Up @@ -157,28 +157,28 @@ void readTextureBlock(std::ifstream &stream, dmd_multimesh_t &multimesh)
texel.y() = 1.0f - texel.y();

multimesh.texvrtices->push_back(texel);
}
}

line = getLine(stream);
line = getLine(stream);

for (unsigned int i = 0; i < multimesh.tex_f_count; ++i)
{
line = delete_symbol(getLine(stream), '\t');
std::istringstream ss(line);
std::istringstream ss(line);


face_t texface;

while (!ss.eof())
{
{
unsigned int idx = 0;
ss >> idx;
ss >> idx;

texface.push_back(idx-1);
}

multimesh.texfaces.push_back(texface);
}
}
}

2 changes: 1 addition & 1 deletion viewer/osgdb_dmd/src/reader-writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterDMD::readNode(std::ifstream &stream,

vertices->push_back(mesh.vertices->at(face[0]));
vertices->push_back(mesh.vertices->at(face[1]));
vertices->push_back(mesh.vertices->at(face[2]));
vertices->push_back(mesh.vertices->at(face[2]));
}

osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
Expand Down
8 changes: 4 additions & 4 deletions viewer/route-loader/include/abstract-loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ class ROUTE_LOADER_EXPORT RouteLoader : public osg::Referenced
virtual void load(std::string routeDir, float view_dist = 1000.0f) = 0;

/// Get route scene group node
virtual osg::Group *getRoot();
virtual osg::Group *getRoot();

virtual MotionPath *getMotionPath(int direction) = 0;

protected:
protected:

/// Route directory
std::string routeDir;

/// Route static scene root node
osg::ref_ptr<osg::Group> root;
osg::ref_ptr<osg::Group> root;

/// Destructor
virtual ~RouteLoader() {}
Expand All @@ -76,7 +76,7 @@ class ROUTE_LOADER_EXPORT RouteLoader : public osg::Referenced
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
typedef RouteLoader* (*GetRouteLoader)();
using GetRouteLoader = RouteLoader* (*)();

//------------------------------------------------------------------------------
//
Expand Down
2 changes: 1 addition & 1 deletion viewer/sound-manager/include/asound-log.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <QFile>

class LogFileHandler : public QObject
{
{
public:

/// Constructor
Expand Down
2 changes: 1 addition & 1 deletion viewer/viewer/include/QGraphicsViewAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class QGraphicsViewAdapter : public QObject
int _width;
int _height;

typedef std::map<int, Qt::Key> KeyMap;
using KeyMap = std::map<int, Qt::Key>;
KeyMap _keyMap;
Qt::KeyboardModifiers _qtKeyModifiers;

Expand Down
24 changes: 10 additions & 14 deletions viewer/viewer/include/abstract-manipulator.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef ABSTRACT_MANIPULATOR_H
#define ABSTRACT_MANIPULATOR_H
#ifndef ABSTRACT_MANIPULATOR_H
#define ABSTRACT_MANIPULATOR_H

#include <QObject>
#include "camera-position.h"

#include <osgGA/TrackballManipulator>
#include <osgGA/TrackballManipulator>

#include "camera-position.h"
#include <QObject>

//------------------------------------------------------------------------------
//
Expand All @@ -15,28 +15,24 @@ class AbstractManipulator : public QObject, public osgGA::TrackballManipulator
Q_OBJECT

public:
AbstractManipulator(QObject* parent = Q_NULLPTR);

AbstractManipulator(QObject *parent = Q_NULLPTR);

bool handleFrame(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa);
bool handleFrame(const osgGA::GUIEventAdapter& event_adapter, osgGA::GUIActionAdapter& action_adapter);

protected:
camera_position_t camera_position;

camera_position_t cp;

double start_time;
float delta_time;
double start_time;
float delta_time;

virtual ~AbstractManipulator();

virtual void process_displays_lock();

signals:

void lock_displays(bool lock);

public slots:

void getCameraPosition(camera_position_t cp);
};

Expand Down
28 changes: 14 additions & 14 deletions viewer/viewer/include/analog-rotation.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
#ifndef ANALOG_ROTATION_H
#define ANALOG_ROTATION_H
#ifndef ANALOG_ROTATION_H
#define ANALOG_ROTATION_H

#include "proc-animation.h"
#include "proc-animation.h"

#include <osg/Matrix>
#include <osg/Vec3>

class AnalogRotation : public ProcAnimation
{
public:

AnalogRotation(osg::MatrixTransform *transform);

AnalogRotation(osg::MatrixTransform* transform);
~AnalogRotation();

private:
float min_angle;
float max_angle;
float angle;

float min_angle;
float max_angle;
float angle;

float cur_pos;
float cur_pos;

bool infinity;
bool infinity;

osg::Vec3 axis;
osg::Vec3 axis;
osg::Matrix matrix;

void anim_step(float t, float dt);

bool load_config(ConfigReader &cfg);
bool load_config(ConfigReader& cfg);

void update();
};
Expand Down
25 changes: 13 additions & 12 deletions viewer/viewer/include/analog-translation.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
#ifndef ANALOG_TRANSLATION_H
#define ANALOG_TRANSLATION_H
#ifndef ANALOG_TRANSLATION_H
#define ANALOG_TRANSLATION_H

#include "proc-animation.h"
#include "proc-animation.h"

#include <osg/Vec3>
#include <osg/Matrix>

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
class AnalogTranslation : public ProcAnimation
{
public:

AnalogTranslation(osg::MatrixTransform *transform);
AnalogTranslation(osg::MatrixTransform* transform);

~AnalogTranslation();

private:
float min_motion;
float max_motion;
float motion;

float min_motion;
float max_motion;
float motion;

float cur_pos;
float cur_pos;

osg::Vec3 axis;
osg::Vec3 axis;
osg::Matrix matrix;

void anim_step(float t, float dt);

bool load_config(ConfigReader &cfg);
bool load_config(ConfigReader& cfg);

void update();
};
Expand Down
3 changes: 2 additions & 1 deletion viewer/viewer/include/anim-transform-visitor.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef ANIM_TRANSFORM_VISITOR_H
#define ANIM_TRANSFORM_VISITOR_H

#include <osg/NodeVisitor>
#include "animations-list.h"

#include <osg/NodeVisitor>

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion viewer/viewer/include/animation-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <osgGA/GUIEventHandler>

#include "animations-list.h"
#include "proc-animation.h"

//------------------------------------------------------------------------------
//
Expand Down
5 changes: 3 additions & 2 deletions viewer/viewer/include/animations-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#define ANIMATIONS_LIST_H

#include <QMap>
#include "proc-animation.h"

class ProcAnimation;

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
typedef QMap<size_t, ProcAnimation *> animations_t;
using animations_t = QMap<size_t, ProcAnimation *>;

#endif // ANIMATIONS_LIST_H
29 changes: 13 additions & 16 deletions viewer/viewer/include/camera-position.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
#ifndef CAMERA_POSITION_H
#define CAMERA_POSITION_H
#ifndef CAMERA_POSITION_H
#define CAMERA_POSITION_H

#include <QMetaType>
#include <osg/Vec3d>

#include <osg/Vec3d>
#include <QMetaType>

//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
struct camera_position_t
{
osg::Vec3d position = {0.0, 0.0, 0.0};
osg::Vec3d attitude = {-osg::PI_2, 0.0, 0.0};
osg::Vec3d driver_pos = {0.0, 0.0, 1.75};
osg::Vec3d viewer_pos = {0.0, 150.0, 0.0};
osg::Vec3d front = {0.0, 1.0, 0.0};
osg::Vec3d right = {1.0, 0.0, 0.0};
osg::Vec3d up = {0.0, 0.0, 1.0};
bool is_orient_bwd = false;
camera_position_t();

camera_position_t()
{

}
osg::Vec3d position;
osg::Vec3d attitude;
osg::Vec3d driver_pos;
osg::Vec3d viewer_pos;
osg::Vec3d front;
osg::Vec3d right;
osg::Vec3d up;
bool is_orient_bwd;
};

Q_DECLARE_METATYPE(camera_position_t)
Expand Down
Loading