mirror of
https://github.com/ApfelTeeSaft/vb01.git
synced 2026-08-26 19:33:45 +00:00
readable .vb format
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include"quaternion.h"
|
||||
#include"vector.h"
|
||||
#include<vector>
|
||||
#include<string>
|
||||
|
||||
namespace vb01{
|
||||
class Mesh;
|
||||
@@ -15,11 +16,11 @@ namespace vb01{
|
||||
class Node{
|
||||
public:
|
||||
struct Transform{
|
||||
Vector3 position,scale;
|
||||
Quaternion orientation;
|
||||
Vector3 position=Vector3::VEC_ZERO,scale=Vector3::VEC_IJK;
|
||||
Quaternion orientation=Quaternion::QUAT_W;
|
||||
};
|
||||
|
||||
Node(Vector3=Vector3::VEC_ZERO,Quaternion=Quaternion::QUAT_W,Vector3=Vector3::VEC_IJK);
|
||||
Node(Vector3=Vector3::VEC_ZERO,Quaternion=Quaternion::QUAT_W,Vector3=Vector3::VEC_IJK,std::string="");
|
||||
virtual ~Node();
|
||||
void attachMesh(Mesh*);
|
||||
void attachParticleEmitter(ParticleEmitter*);
|
||||
@@ -29,20 +30,23 @@ namespace vb01{
|
||||
void addLight(Light*);
|
||||
void removeLight(int);
|
||||
void addText(Text*);
|
||||
void lookAt(Vector3,Vector3);
|
||||
Transform getWorldTransform();
|
||||
Vector3 getLocalAxis(int);
|
||||
Vector3 localToGlobal(Vector3);
|
||||
Vector3 globalToLocal(Vector3);
|
||||
void lookAt(Vector3,Vector3,Node*);
|
||||
void updateLocalAxis();
|
||||
void setOrientation(Quaternion);
|
||||
void getDescendants(Node*,std::vector<Node*>&);
|
||||
Vector3 localToGlobalPosition(Vector3);
|
||||
Vector3 globalToLocalPosition(Vector3);
|
||||
Quaternion localToGlobalOrientation(Quaternion);
|
||||
Quaternion globalToLocalOrientation(Quaternion);
|
||||
Vector3 localToGlobalScale(Vector3);
|
||||
Vector3 globalToLocalScale(Vector3);
|
||||
inline Text* getText(int i){return texts[i];}
|
||||
inline Vector3 getWorldPosition(){return getWorldTransform().position;}
|
||||
inline Quaternion getWorldOrientation(){return getWorldTransform().orientation;}
|
||||
inline Vector3 getWorldScale(){return getWorldTransform().scale;}
|
||||
inline std::vector<Mesh*>& getMeshes(){return meshes;}
|
||||
inline Mesh* getMesh(int i){return meshes[i];}
|
||||
inline Node* getParent(){return parent;}
|
||||
inline void setParent(Node *par){this->parent=par;}
|
||||
inline Node* getChild(int i){return children[i];}
|
||||
inline Vector3 getLocalAxis(int i){return axis[i];}
|
||||
inline Vector3 getPosition(){return pos;}
|
||||
inline Vector3 getScale(){return scale;}
|
||||
inline void setPosition(Vector3 pos){this->pos=pos;}
|
||||
@@ -53,21 +57,21 @@ namespace vb01{
|
||||
inline int getNumLights(){return lights.size();}
|
||||
inline int getNumChildren(){return children.size();}
|
||||
inline Quaternion getOrientation(){return orientation;}
|
||||
inline void setOrientation(Quaternion q){this->orientation=q;}
|
||||
inline bool isVisible(){return visible;}
|
||||
inline std::string getName(){return name;}
|
||||
inline void setVisible(bool v){this->visible=v;}
|
||||
void getDescendants(Node*,std::vector<Node*>&);
|
||||
protected:
|
||||
void updateShaders();
|
||||
|
||||
bool visible=true;
|
||||
Vector3 pos,scale;
|
||||
Vector3 pos,scale,axis[3];
|
||||
Quaternion orientation;
|
||||
std::vector<Mesh*> meshes;
|
||||
std::vector<ParticleEmitter*> emitters;
|
||||
std::vector<Node*> children;
|
||||
std::vector<Light*> lights;
|
||||
std::vector<Text*> texts;
|
||||
std::string name;
|
||||
Node *parent=nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user