Core Scene Graph Data Structures in C++


Base Classes

In addition to int, float, bool, vector<int>, and vector<float>, these classes define various types values used as node field values in the DGP2023 implementation.

Color

class Color {
  public:
    float               r,g,b;
  public:
                        Color(float R, float G=, float B);
    Color&              operator=(Color& src);
};

Vec2f

class Vec2f {
  public:
    float               x,y;
  public:
                        Vec2f(float X, float Y);
    float&              operator[] (int i);
    Vec2f&              operator=  (Vec2f& src);
    Vec2f&              operator+= (Vec2f& rhs);
    Vec2f&              operator-= (Vec2f& rhs);
    float               norm() const;
    void                normalize();
};

Vec3f

class Vec3f {
  public:
    float               x,y,z;
  public:
                        Vec3f(float X, float Y, float Z);
    float&              operator[] (int i);
    Vec3f&              operator=  (Vec3f& rhs);
    Vec3f&              operator+= (Vec3f& rhs);
    Vec3f&              operator-= (Vec3f& rhs);
    float               norm() const;
    void                normalize();
};

Vec4f

class Vec4f {
  public:
    float               x,y,z,w;
  public:
                        Vec4f(float X, float Y, float Z, float W);
    float&              operator[] (int i);
    Vec4f&              operator=  (Vec4f& rhs);
    Vec4f&              operator+= (Vec4f& rhs);
    Vec4f&              operator-= (Vec4f& rhs);
    float               norm() const;
    void                normalize();
};

Rotation

class Rotation {
  public:
                        Rotation();
                        Rotation(float x, float y, float z, float angle);
                        Rotation(Vec3f& axis, float angle);
    void                set(float x, float y, float z, float angle);
    void                set(Vec4f& value);
    void                operator=(Vec4f& value);
    Vec3f&              getAxis();
    float               getAngle();
};