mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
use glm instead of Math3D in world
This commit is contained in:
@@ -10,9 +10,9 @@ http://mozilla.org/MPL/2.0/.
|
||||
#pragma once
|
||||
|
||||
#include "utilities/Classes.h"
|
||||
#include "utilities/dumb3d.h"
|
||||
#include "rendering/geometrybank.h"
|
||||
#include "utilities/utilities.h"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
struct map_colored_paths {
|
||||
std::vector<gfx::geometrybank_handle> switches;
|
||||
@@ -42,7 +42,7 @@ struct segment_data {
|
||||
class TSegment
|
||||
{ // aproksymacja toru (zwrotnica ma dwa takie, jeden z nich jest aktywny)
|
||||
private:
|
||||
Math3D::vector3 Point1, CPointOut, CPointIn, Point2;
|
||||
glm::dvec3 Point1, CPointOut, CPointIn, Point2;
|
||||
float
|
||||
fRoll1 { 0.f },
|
||||
fRoll2 { 0.f }; // przechyłka na końcach
|
||||
@@ -52,63 +52,54 @@ class TSegment
|
||||
int iSegCount = 0; // ilość odcinków do rysowania krzywej
|
||||
double fDirection = 0.0; // Ra: kąt prostego w planie; dla łuku kąt od Point1
|
||||
double fStoop = 0.0; // Ra: kąt wzniesienia; dla łuku od Point1
|
||||
Math3D::vector3 vA, vB, vC; // współczynniki wielomianów trzeciego stopnia vD==Point1
|
||||
glm::dvec3 vA, vB, vC; // współczynniki wielomianów trzeciego stopnia vD==Point1
|
||||
TTrack *pOwner = nullptr; // wskaźnik na właściciela
|
||||
|
||||
Math3D::vector3
|
||||
GetFirstDerivative(double const fTime) const;
|
||||
double
|
||||
RombergIntegral(double const fA, double const fB) const;
|
||||
double
|
||||
GetTFromS(double const s) const;
|
||||
Math3D::vector3
|
||||
RaInterpolate(double const t) const;
|
||||
Math3D::vector3
|
||||
RaInterpolate0(double const t) const;
|
||||
glm::dvec3 GetFirstDerivative(double const fTime) const;
|
||||
double RombergIntegral(double const fA, double const fB) const;
|
||||
double GetTFromS(double const s) const;
|
||||
glm::dvec3 RaInterpolate(double const t) const;
|
||||
glm::dvec3 RaInterpolate0(double const t) const;
|
||||
|
||||
public:
|
||||
bool bCurve = false;
|
||||
|
||||
TSegment(TTrack *owner);
|
||||
bool
|
||||
Init( Math3D::vector3 NewPoint1, Math3D::vector3 NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0);
|
||||
bool
|
||||
Init( Math3D::vector3 &NewPoint1, Math3D::vector3 NewCPointOut, Math3D::vector3 NewCPointIn, Math3D::vector3 &NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0, bool bIsCurve = true);
|
||||
bool Init(glm::dvec3 NewPoint1, glm::dvec3 NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0);
|
||||
bool Init(glm::dvec3 &NewPoint1, glm::dvec3 NewCPointOut, glm::dvec3 NewCPointIn, glm::dvec3 &NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0, bool bIsCurve = true);
|
||||
double
|
||||
ComputeLength() const; // McZapkie-150503
|
||||
// finds point on segment closest to specified point in 3d space. returns: point on segment as value in range 0-1
|
||||
double
|
||||
find_nearest_point( glm::dvec3 const &Point ) const;
|
||||
inline
|
||||
Math3D::vector3
|
||||
inline
|
||||
glm::dvec3
|
||||
GetDirection1() const {
|
||||
return bCurve ? CPointOut - Point1 : CPointOut; };
|
||||
inline
|
||||
Math3D::vector3
|
||||
glm::dvec3
|
||||
GetDirection2() const {
|
||||
return bCurve ? CPointIn - Point2 : CPointIn; };
|
||||
Math3D::vector3
|
||||
glm::dvec3
|
||||
GetDirection(double const fDistance) const;
|
||||
inline
|
||||
Math3D::vector3
|
||||
glm::dvec3
|
||||
GetDirection() const {
|
||||
return CPointOut; };
|
||||
Math3D::vector3
|
||||
glm::dvec3
|
||||
FastGetDirection(double const fDistance, double const fOffset);
|
||||
/*
|
||||
Math3D::vector3
|
||||
GetPoint(double const fDistance) const;
|
||||
*/
|
||||
void
|
||||
RaPositionGet(double const fDistance, Math3D::vector3 &p, Math3D::vector3 &a) const;
|
||||
Math3D::vector3
|
||||
FastGetPoint(double const t) const;
|
||||
void RaPositionGet(double const fDistance, glm::dvec3 &p, glm::dvec3 &a) const;
|
||||
glm::dvec3 FastGetPoint(double const t) const;
|
||||
inline
|
||||
Math3D::vector3
|
||||
glm::dvec3
|
||||
FastGetPoint_0() const {
|
||||
return Point1; };
|
||||
inline
|
||||
Math3D::vector3
|
||||
glm::dvec3
|
||||
FastGetPoint_1() const {
|
||||
return Point2; };
|
||||
inline
|
||||
@@ -123,7 +114,7 @@ public:
|
||||
r2 = fRoll2; }
|
||||
|
||||
bool
|
||||
RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Origin, gfx::vertex_array const &ShapePoints, bool const Transition, double fTextureLength, double Texturescale = 1.0, int iSkip = 0, int iEnd = 0, std::pair<float, float> fOffsetX = {0.f, 0.f}, glm::vec3 **p = nullptr, bool bRender = true );
|
||||
RenderLoft( gfx::vertex_array &Output, glm::dvec3 const &Origin, gfx::vertex_array const &ShapePoints, bool const Transition, double fTextureLength, double Texturescale = 1.0, int iSkip = 0, int iEnd = 0, std::pair<float, float> fOffsetX = {0.f, 0.f}, glm::vec3 **p = nullptr, bool bRender = true );
|
||||
/*
|
||||
void
|
||||
Render();
|
||||
|
||||
Reference in New Issue
Block a user