8#include <glm/mat4x4.hpp>
24 void setMode(
const std::string &mode);
26 std::string
getMode()
const {
return mode_; }
29 void setSpace(
const std::string &space);
31 std::string
getSpace()
const {
return space_; }
34 void setSize(
float size);
39 void setPosition(
float x,
float y,
float z);
48 void setRotationEuler(
float x,
float y,
float z);
57 void setScale(
float x,
float y,
float z);
66 void setBounds(
float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ);
81 void setSnapTranslate(
float x,
float y,
float z);
83 void setSnapRotate(
float degrees);
85 void setSnapScale(
float s);
98 float getMatrix(
int index)
const;
104 std::string pick(
float ox,
float oy,
float oz,
float dx,
float dy,
float dz);
107 bool beginDrag(
const std::string &axis,
float ox,
float oy,
float oz,
float dx,
float dy,
110 bool updateDrag(
float ox,
float oy,
float oz,
float dx,
float dy,
float dz);
129 std::string getPartKind(
int index)
const;
131 std::string getPartAxis(
int index)
const;
133 float getPartColorR(
int index)
const;
135 float getPartColorG(
int index)
const;
137 float getPartColorB(
int index)
const;
139 float getPartColorA(
int index)
const;
141 float getPartOriginX(
int index)
const;
143 float getPartOriginY(
int index)
const;
145 float getPartOriginZ(
int index)
const;
147 float getPartDirX(
int index)
const;
149 float getPartDirY(
int index)
const;
151 float getPartDirZ(
int index)
const;
153 float getPartLength(
int index)
const;
155 float getPartRadius(
int index)
const;
162 glm::vec3
dir{1.f, 0.f, 0.f};
165 glm::vec4
color{1.f, 0.f, 0.f, 1.f};
168 glm::mat4 localRotationMatrix()
const;
169 glm::mat4 worldMatrix()
const;
170 glm::vec3 axisWorld(
int axis)
const;
171 void colorForAxis(
const std::string &axis, glm::vec4 &out)
const;
173 float hitAxis(
const glm::vec3 &ro,
const glm::vec3 &rd,
int axisIndex,
float &outT)
const;
174 float hitPlane(
const glm::vec3 &ro,
const glm::vec3 &rd,
int planeMask,
float &outT)
const;
175 float hitRing(
const glm::vec3 &ro,
const glm::vec3 &rd,
int axisIndex,
float &outT)
const;
176 float hitBoundHandle(
const glm::vec3 &ro,
const glm::vec3 &rd,
int handle,
float &outT)
const;
178 glm::vec3 projectToDragPlane(
const glm::vec3 &ro,
const glm::vec3 &rd)
const;
179 void applySnapTranslate(glm::vec3 &
v)
const;
180 float applySnapRotate(
float radians)
const;
181 float applySnapScale(
float s)
const;
183 bool validPart(
int index)
const;
185 std::string mode_ =
"translate";
186 std::string space_ =
"world";
189 glm::vec3 position_{0.f};
190 glm::vec3 rotation_{0.f};
191 glm::vec3 scale_{1.f};
192 glm::vec3 boundsMin_{-0.5f};
193 glm::vec3 boundsMax_{0.5f};
195 glm::vec3 snapTranslate_{0.f};
196 float snapRotateDeg_ = 0.f;
197 float snapScale_ = 0.f;
199 bool dragging_ =
false;
200 std::string activeAxis_;
201 std::string hoverAxis_;
203 glm::vec3 dragStartPos_{0.f};
204 glm::vec3 dragStartRot_{0.f};
205 glm::vec3 dragStartScale_{0.f};
206 glm::vec3 dragStartHit_{0.f};
207 glm::vec3 dragPlaneNormal_{0.f, 1.f, 0.f};
208 glm::vec3 dragAxisDir_{1.f, 0.f, 0.f};
210 std::vector<Part> parts_;
#define EVENGINE_API_ORCHESTRATION