1
0
Fork 0
blockofighter/src/sphere.h

62 lines
988 B
C
Raw Permalink Normal View History

2014-02-16 14:32:28 +00:00
#ifndef __SPHERE_H_INCLUDED__
#define __SPHERE_H_INCLUDED__
#include "object.h"
#include "material.h"
#include "mesh.h"
class SphereAppearance;
2015-06-03 12:29:34 +00:00
// Object for sphere
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
class Sphere : public Object {
2014-02-16 14:32:28 +00:00
private:
2015-06-03 12:29:34 +00:00
float r;
SphereAppearance *appearance;
SphereShape *geometry;
2014-02-16 14:32:28 +00:00
public:
2015-06-03 12:29:34 +00:00
Sphere(void);
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
void setRadius(float r);
void setColor(float red, float green, float blue);
2014-02-16 14:32:28 +00:00
};
2015-06-03 12:29:34 +00:00
// Appearance of sphere
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
class SphereAppearance : public Appearance {
2014-02-16 14:32:28 +00:00
private:
2015-06-03 12:29:34 +00:00
float r;
2014-02-16 14:32:28 +00:00
public:
2015-06-03 12:29:34 +00:00
SphereAppearance(void);
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
void setRadius(float r);
void draw(void);
2014-02-16 14:32:28 +00:00
};
2015-06-03 12:29:34 +00:00
// Geometry of sphere
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
class SphereShape : public Shape {
2014-02-16 14:32:28 +00:00
private:
2015-06-03 12:29:34 +00:00
float r;
2014-02-16 14:32:28 +00:00
public:
2015-06-03 12:29:34 +00:00
SphereShape(Object *sphere);
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
void setRadius(float r);
float getRadius(void);
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
float calculateMomentOfInertia(float *rotationvector);
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
bool checkCollision(Object *target);
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
bool checkCollisionPeer(SphereShape *target);
bool checkCollisionPeer(MeshShape *target);
2014-02-16 14:32:28 +00:00
2015-06-03 12:29:34 +00:00
friend class Sphere;
friend class MeshShape;
2014-02-16 14:32:28 +00:00
};
#endif