Added RenderCamera and RenderView class skeletons. Also added a common GL header file.
parent
3a2d9e3dcb
commit
4d05013cdc
|
@ -0,0 +1,5 @@
|
|||
.DS_Store
|
||||
# vim swap files
|
||||
.*.sw?
|
||||
# compiled stuff
|
||||
*.o
|
|
@ -11,6 +11,8 @@
|
|||
20138FCE1A3DC7A700FD0095 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20138FCD1A3DC7A700FD0095 /* SDL2.framework */; };
|
||||
205D36CE1A6749FB00C05BD8 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 205D36CD1A6749FB00C05BD8 /* main.cpp */; };
|
||||
205D370C1A674B1D00C05BD8 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 205D370B1A674B1D00C05BD8 /* OpenGL.framework */; };
|
||||
20A8CE541A899B72004D2504 /* RenderCamera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20A8CE501A899B72004D2504 /* RenderCamera.cpp */; };
|
||||
20A8CE551A899B72004D2504 /* RenderView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20A8CE521A899B72004D2504 /* RenderView.cpp */; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
|
@ -20,6 +22,11 @@
|
|||
20138FCD1A3DC7A700FD0095 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; };
|
||||
205D36CD1A6749FB00C05BD8 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../../src/main.cpp; sourceTree = SOURCE_ROOT; };
|
||||
205D370B1A674B1D00C05BD8 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
|
||||
20A8CE501A899B72004D2504 /* RenderCamera.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderCamera.cpp; path = ../../src/RenderCamera.cpp; sourceTree = SOURCE_ROOT; };
|
||||
20A8CE511A899B72004D2504 /* RenderCamera.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = RenderCamera.hpp; path = ../../src/RenderCamera.hpp; sourceTree = SOURCE_ROOT; };
|
||||
20A8CE521A899B72004D2504 /* RenderView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderView.cpp; path = ../../src/RenderView.cpp; sourceTree = SOURCE_ROOT; };
|
||||
20A8CE531A899B72004D2504 /* RenderView.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = RenderView.hpp; path = ../../src/RenderView.hpp; sourceTree = SOURCE_ROOT; };
|
||||
20A8CE681A899CF6004D2504 /* GL.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = GL.hpp; path = ../../src/GL.hpp; sourceTree = SOURCE_ROOT; };
|
||||
8D1107320486CEB800E47090 /* Roll them Bones.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Roll them Bones.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
|
@ -41,6 +48,10 @@
|
|||
080E96DDFE201D6D7F000001 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
20A8CE501A899B72004D2504 /* RenderCamera.cpp */,
|
||||
20A8CE511A899B72004D2504 /* RenderCamera.hpp */,
|
||||
20A8CE521A899B72004D2504 /* RenderView.cpp */,
|
||||
20A8CE531A899B72004D2504 /* RenderView.hpp */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
|
@ -95,6 +106,7 @@
|
|||
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
20A8CE681A899CF6004D2504 /* GL.hpp */,
|
||||
);
|
||||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
|
@ -179,6 +191,8 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
205D36CE1A6749FB00C05BD8 /* main.cpp in Sources */,
|
||||
20A8CE541A899B72004D2504 /* RenderCamera.cpp in Sources */,
|
||||
20A8CE551A899B72004D2504 /* RenderView.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/* ================================================================
|
||||
This file provides common includes to access OpenGL types and functions
|
||||
================================================================ */
|
||||
#if defined(__IPHONEOS__) || defined(__ANDROID__)
|
||||
#define HAVE_OPENGLES
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENGLES
|
||||
#include "SDL_opengles.h"
|
||||
#else
|
||||
#include "SDL_opengl.h"
|
||||
#endif
|
|
@ -0,0 +1,19 @@
|
|||
/* ================================================================
|
||||
RenderCamera
|
||||
----------------
|
||||
This header file defines the RenderCamera class.
|
||||
================================================================ */
|
||||
#include "RenderCamera.hpp"
|
||||
/* ======== Constructors and Destructors ======== */
|
||||
RenderCamera::RenderCamera() {
|
||||
render_mode = 0;
|
||||
render_view = NULL;
|
||||
}
|
||||
RenderCamera::~RenderCamera() {
|
||||
}
|
||||
/* ======== Setter functions ======== */
|
||||
int RenderCamera::setRenderView(RenderView *rv) {
|
||||
if (rv == NULL) return 1;
|
||||
render_view = rv;
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/* ================================================================
|
||||
RenderCamera
|
||||
----------------
|
||||
This header file describes the RenderCamera class.
|
||||
|
||||
A RenderCamera is the object responsible for providing a rendering position,
|
||||
orientation, and perspective transformations. A RenderCamera exists within a
|
||||
RenderScene and outputs all data to the friend class, RenderView.
|
||||
================================================================ */
|
||||
#ifndef RENDERCAMERA_HPP
|
||||
#define RENDERCAMERA_HPP
|
||||
#include "GL.hpp"
|
||||
#include "RenderView.hpp"
|
||||
class RenderCamera {
|
||||
public:
|
||||
RenderCamera();
|
||||
~RenderCamera();
|
||||
int setRenderView(RenderView *view);
|
||||
private:
|
||||
//Vec3 x, y, z; // TODO: replace with quaternion
|
||||
int render_mode; // 0 = perspective, 1 = orthogonal
|
||||
RenderView *render_view; // RenderView to render the scene to
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,25 @@
|
|||
/* ================================================================
|
||||
RenderView
|
||||
----------------
|
||||
This file defines our RenderView object.
|
||||
================================================================ */
|
||||
#include "RenderView.hpp"
|
||||
/* ======== Constructors and Destructors ======== */
|
||||
RenderView::RenderView(unsigned int width, unsigned int height) {
|
||||
program = fbo = fbo_depth = fbo_tex = 0;
|
||||
w = h = 0;
|
||||
x = y = 0;
|
||||
createView(width, height);
|
||||
}
|
||||
RenderView::~RenderView() {
|
||||
destroyView();
|
||||
}
|
||||
/* ======== Setters ======== */
|
||||
int RenderView::createView(unsigned int width, unsigned int height) {
|
||||
// TODO: call destroyView() and create new FBO at width and height
|
||||
return 0;
|
||||
}
|
||||
int RenderView::destroyView() {
|
||||
// TODO: destroy FBO
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/* ================================================================
|
||||
RenderView
|
||||
----------------
|
||||
This header file describes our RenderView object.
|
||||
|
||||
A RenderView is the target of a RenderCamera and consists of a framebuffer
|
||||
object and shader program to render said framebuffer. For all intents and
|
||||
purposes, it is a wrapper around a FBO.
|
||||
================================================================ */
|
||||
#ifndef RENDERVIEW_HPP
|
||||
#define RENDERVIEW_HPP
|
||||
#include "GL.hpp"
|
||||
class RenderView {
|
||||
friend class RenderCamera;
|
||||
public:
|
||||
RenderView(unsigned int width, unsigned int height);
|
||||
~RenderView();
|
||||
private:
|
||||
GLuint program; // Compiled shader program to render with
|
||||
GLuint fbo; // The fbo that RenderCamera will draw to
|
||||
GLuint fbo_depth; // The fbo depth buffer
|
||||
GLuint fbo_tex; // The texture of the fbo
|
||||
unsigned int w, h; // width and height of this view (also of fbo)
|
||||
int x, y; // x and y offsets of rendering to screen
|
||||
int createView(unsigned int width, unsigned int height);
|
||||
int destroyView();
|
||||
};
|
||||
#endif
|
11
src/main.cpp
11
src/main.cpp
|
@ -1,14 +1,5 @@
|
|||
#include "SDL.h"
|
||||
|
||||
#if defined(__IPHONEOS__) || defined(__ANDROID__)
|
||||
#define HAVE_OPENGLES
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENGLES
|
||||
#include "SDL_opengles.h"
|
||||
#else
|
||||
#include "SDL_opengl.h"
|
||||
#endif
|
||||
#include "GL.hpp"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// TEMP location of video vars
|
||||
|
|
Loading…
Reference in New Issue