Define classes as structs
for default public access and inheritance
This commit is contained in:
parent
9b03876a3e
commit
cef70d5c0f
|
@ -4,10 +4,9 @@
|
|||
#include "transformation.hpp"
|
||||
#include "scene.hpp"
|
||||
|
||||
class Camera :
|
||||
public Transformation
|
||||
struct Camera :
|
||||
Transformation
|
||||
{
|
||||
public:
|
||||
inline Camera(const Scene &scene) : _scene(scene) {}
|
||||
|
||||
inline void draw() const;
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
#include "texture.hpp"
|
||||
|
||||
class Material
|
||||
struct Material
|
||||
{
|
||||
public:
|
||||
inline void use() const;
|
||||
|
||||
const Texture *texture;
|
||||
|
|
|
@ -7,12 +7,11 @@
|
|||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class Mtllib:
|
||||
public Resource
|
||||
struct Mtllib:
|
||||
Resource
|
||||
{
|
||||
RESOURCE(Mtllib)
|
||||
|
||||
public:
|
||||
const Material *operator[](const std::string &name) const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Object :
|
||||
public Transformation
|
||||
struct Object :
|
||||
Transformation
|
||||
{
|
||||
public:
|
||||
Object(const Model &model) : _model(model) {};
|
||||
void draw(const glm::mat4 &mvp) const;
|
||||
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
class Program:
|
||||
public Resource
|
||||
struct Program:
|
||||
Resource
|
||||
{
|
||||
RESOURCE(Program)
|
||||
|
||||
public:
|
||||
void use() const;
|
||||
GLuint get_uniform_location(const GLchar *name) const;
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
|
||||
#include "store.hpp"
|
||||
|
||||
class Resource
|
||||
struct Resource
|
||||
{
|
||||
friend class Store;
|
||||
private:
|
||||
friend struct Store;
|
||||
|
||||
__attribute__((unused)) // Used by friend class Store
|
||||
unsigned long _ref_count = 0;
|
||||
};
|
||||
|
||||
#define RESOURCE(T) \
|
||||
private: \
|
||||
friend class ::Store; \
|
||||
friend struct ::Store; \
|
||||
T(Store &store, const std::string &name); \
|
||||
static const std::string filename(const std::string &name);
|
||||
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Scene
|
||||
struct Scene
|
||||
{
|
||||
public:
|
||||
inline Scene &operator <<(Object *object);
|
||||
|
||||
inline void draw(const glm::mat4 &mvp) const;
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
#include "gl.hpp"
|
||||
|
||||
class Shader
|
||||
struct Shader
|
||||
{
|
||||
public:
|
||||
Shader(GLenum type, const char *filename);
|
||||
inline GLuint id() const { return _id; };
|
||||
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class Resource;
|
||||
struct Resource;
|
||||
|
||||
class Store
|
||||
struct Store
|
||||
{
|
||||
public:
|
||||
template <class T>
|
||||
const T *load(const std::string &name);
|
||||
|
||||
|
|
|
@ -6,13 +6,11 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
class Texture:
|
||||
public Resource
|
||||
struct Texture:
|
||||
Resource
|
||||
{
|
||||
RESOURCE(Texture)
|
||||
|
||||
public:
|
||||
|
||||
void use() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Transformation
|
||||
struct Transformation
|
||||
{
|
||||
public:
|
||||
glm::mat4 transformation() const;
|
||||
|
||||
glm::mat4 base;
|
||||
|
|
Reference in New Issue