1
0
Fork 0

Define classes as structs

for default public access and inheritance
This commit is contained in:
Meoweg 2015-11-13 10:47:30 +00:00
parent 9b03876a3e
commit cef70d5c0f
11 changed files with 20 additions and 31 deletions

View File

@ -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;

View File

@ -3,9 +3,8 @@
#include "texture.hpp"
class Material
struct Material
{
public:
inline void use() const;
const Texture *texture;

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -3,9 +3,8 @@
#include "gl.hpp"
class Shader
struct Shader
{
public:
Shader(GLenum type, const char *filename);
inline GLuint id() const { return _id; };

View File

@ -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);

View File

@ -6,13 +6,11 @@
#include <string>
class Texture:
public Resource
struct Texture:
Resource
{
RESOURCE(Texture)
public:
void use() const;
private:

View File

@ -3,9 +3,8 @@
#include <glm/glm.hpp>
class Transformation
struct Transformation
{
public:
glm::mat4 transformation() const;
glm::mat4 base;