2011-10-25 05:03:10 +00:00
|
|
|
//
|
|
|
|
|
// KRSettings.h
|
|
|
|
|
// KREngine
|
|
|
|
|
//
|
2012-03-15 20:09:01 +00:00
|
|
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
2011-10-25 06:16:47 +00:00
|
|
|
//
|
|
|
|
|
// Redistribution and use in source and binary forms, with or without modification, are
|
|
|
|
|
// permitted provided that the following conditions are met:
|
|
|
|
|
//
|
|
|
|
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
|
|
|
// conditions and the following disclaimer.
|
|
|
|
|
//
|
|
|
|
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
|
|
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
|
|
|
|
// provided with the distribution.
|
|
|
|
|
//
|
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
|
|
|
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
//
|
|
|
|
|
// The views and conclusions contained in the software and documentation are those of the
|
|
|
|
|
// authors and should not be interpreted as representing official policies, either expressed
|
|
|
|
|
// or implied, of Kearwood Gilbert.
|
2011-10-25 05:03:10 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef KRCAMERA_H
|
|
|
|
|
#define KRCAMERA_H
|
|
|
|
|
|
2013-01-11 03:21:19 +00:00
|
|
|
#include "KREngine-common.h"
|
2012-03-15 23:58:37 +00:00
|
|
|
|
2013-01-11 03:21:19 +00:00
|
|
|
#include "KRMat4.h"
|
|
|
|
|
#include "KRVector2.h"
|
|
|
|
|
#include "KRAABB.h"
|
|
|
|
|
#include "KRShader.h"
|
|
|
|
|
#include "KRContextObject.h"
|
|
|
|
|
#include "KRTexture.h"
|
|
|
|
|
#include "KRContext.h"
|
|
|
|
|
#include "KRViewport.h"
|
|
|
|
|
#include "KRRenderSettings.h"
|
2012-08-15 21:26:06 +00:00
|
|
|
|
2013-03-22 17:17:12 -07:00
|
|
|
#define KRAKEN_FPS_AVERAGE_FRAME_COUNT 30
|
|
|
|
|
|
2013-01-09 22:37:23 +00:00
|
|
|
class KRModel;
|
2012-08-15 21:26:06 +00:00
|
|
|
class KRScene;
|
2012-10-26 01:17:35 +00:00
|
|
|
class KRViewport;
|
2012-08-15 21:26:06 +00:00
|
|
|
|
2012-12-20 22:08:41 +00:00
|
|
|
class KRCamera : public KRNode {
|
2011-10-25 05:03:10 +00:00
|
|
|
public:
|
2012-12-20 22:08:41 +00:00
|
|
|
KRCamera(KRScene &scene, std::string name);
|
2012-08-17 01:04:49 +00:00
|
|
|
virtual ~KRCamera();
|
2012-06-15 00:05:56 +00:00
|
|
|
|
2013-02-08 17:28:17 -08:00
|
|
|
void renderFrame(float deltaTime, GLint renderBufferWidth, GLint renderBufferHeight);
|
2012-08-15 21:26:06 +00:00
|
|
|
|
2012-12-20 22:08:41 +00:00
|
|
|
KRRenderSettings settings;
|
2013-04-30 01:18:36 -07:00
|
|
|
|
|
|
|
|
const KRViewport &getViewport();
|
2013-05-24 12:20:47 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual std::string getElementName();
|
|
|
|
|
virtual tinyxml2::XMLElement *saveXML( tinyxml2::XMLNode *parent);
|
|
|
|
|
virtual void loadXML(tinyxml2::XMLElement *e);
|
2013-06-15 09:56:19 -07:00
|
|
|
|
|
|
|
|
std::string getDebugText();
|
|
|
|
|
|
|
|
|
|
private:
|
2013-02-08 17:28:17 -08:00
|
|
|
void createBuffers(GLint renderBufferWidth, GLint renderBufferHeight);
|
2012-10-20 01:10:57 +00:00
|
|
|
|
2012-12-20 22:08:41 +00:00
|
|
|
GLint backingWidth, backingHeight;
|
|
|
|
|
GLint volumetricBufferWidth, volumetricBufferHeight;
|
2012-10-20 01:10:57 +00:00
|
|
|
|
2012-08-15 21:26:06 +00:00
|
|
|
GLuint compositeFramebuffer, compositeDepthTexture, compositeColorTexture;
|
|
|
|
|
GLuint lightAccumulationBuffer, lightAccumulationTexture;
|
|
|
|
|
|
|
|
|
|
|
2012-11-09 20:55:23 +00:00
|
|
|
GLuint volumetricLightAccumulationBuffer, volumetricLightAccumulationTexture;
|
|
|
|
|
|
2012-08-23 16:55:46 +00:00
|
|
|
void renderPost();
|
2012-10-03 19:29:37 +00:00
|
|
|
|
2012-08-15 21:26:06 +00:00
|
|
|
void destroyBuffers();
|
|
|
|
|
|
2012-10-10 22:09:28 +00:00
|
|
|
KRTexture *m_pSkyBoxTexture;
|
2012-10-26 01:17:35 +00:00
|
|
|
KRViewport m_viewport;
|
2012-11-02 20:50:45 +00:00
|
|
|
|
|
|
|
|
float m_particlesAbsoluteTime;
|
2013-03-21 13:21:04 -07:00
|
|
|
|
|
|
|
|
|
2013-03-22 17:17:12 -07:00
|
|
|
|
2013-03-21 13:21:04 -07:00
|
|
|
typedef struct {
|
|
|
|
|
GLfloat x;
|
|
|
|
|
GLfloat y;
|
|
|
|
|
GLfloat z;
|
|
|
|
|
GLfloat u;
|
|
|
|
|
GLfloat v;
|
|
|
|
|
} DebugTextVertexData;
|
|
|
|
|
|
|
|
|
|
DebugTextVertexData *m_debug_text_vertices;
|
2013-03-21 17:32:26 -07:00
|
|
|
|
2013-06-15 09:56:19 -07:00
|
|
|
// std::string getDebugText();
|
2013-03-22 17:17:12 -07:00
|
|
|
|
|
|
|
|
uint64_t m_last_frame_start;
|
|
|
|
|
int m_frame_times[KRAKEN_FPS_AVERAGE_FRAME_COUNT];
|
|
|
|
|
int m_frame_times_filled;
|
2011-10-25 05:03:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|