2011-10-25 05:03:10 +00:00
|
|
|
//
|
|
|
|
|
// KRSettings.h
|
2021-08-16 16:35:36 -07:00
|
|
|
// Kraken Engine
|
2011-10-25 05:03:10 +00:00
|
|
|
//
|
2022-04-03 21:56:23 -07:00
|
|
|
// Copyright 2022 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
|
|
|
//
|
|
|
|
|
|
2022-07-07 22:51:16 -07:00
|
|
|
#pragma once
|
2011-10-25 05:03:10 +00:00
|
|
|
|
2013-01-11 03:21:19 +00:00
|
|
|
#include "KREngine-common.h"
|
2012-03-15 23:58:37 +00:00
|
|
|
|
2019-12-01 15:49:49 -08:00
|
|
|
#include "KRPipeline.h"
|
2013-01-11 03:21:19 +00:00
|
|
|
#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;
|
2022-03-27 22:37:15 -07:00
|
|
|
class KRSurface;
|
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:
|
2020-06-21 22:42:10 -07:00
|
|
|
static void InitNodeInfo(KrNodeInfo* nodeInfo);
|
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
|
|
|
|
2022-07-04 22:08:05 -07:00
|
|
|
void renderFrame(VkCommandBuffer& commandBuffer, KRSurface& compositeSurface);
|
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
|
|
|
|
2014-03-10 22:32:49 -07:00
|
|
|
const KRViewport &getViewport() const;
|
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();
|
2014-03-18 12:27:08 -07:00
|
|
|
|
|
|
|
|
void flushSkybox(); // this will delete the skybox and cause the camera to reload a new skybox based on the settings
|
2017-07-29 01:20:07 -07:00
|
|
|
Vector2 getDownsample();
|
2014-04-29 00:30:14 -07:00
|
|
|
void setDownsample(float v);
|
2014-06-25 00:45:00 -07:00
|
|
|
|
2017-07-29 01:29:30 -07:00
|
|
|
void setFadeColor(const Vector4 &fade_color);
|
|
|
|
|
Vector4 getFadeColor();
|
2014-11-26 22:24:35 -08:00
|
|
|
|
|
|
|
|
void setSkyBox(const std::string &skyBox);
|
|
|
|
|
const std::string getSkyBox() const;
|
2013-06-15 09:56:19 -07:00
|
|
|
|
|
|
|
|
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 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;
|
|
|
|
|
|
2022-04-06 01:00:13 -07:00
|
|
|
void renderPost(VkCommandBuffer& commandBuffer, KRSurface& surface);
|
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;
|
2014-11-26 22:24:35 -08:00
|
|
|
std::string m_skyBox;
|
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
|
|
|
|
2017-07-29 01:20:07 -07:00
|
|
|
Vector2 m_downsample;
|
2013-03-22 17:17:12 -07:00
|
|
|
|
2017-07-29 01:29:30 -07:00
|
|
|
Vector4 m_fade_color;
|
2014-06-25 00:45:00 -07:00
|
|
|
|
2013-03-21 13:21:04 -07:00
|
|
|
typedef struct {
|
2022-04-03 23:05:30 -07:00
|
|
|
float x;
|
|
|
|
|
float y;
|
|
|
|
|
float z;
|
|
|
|
|
float u;
|
|
|
|
|
float v;
|
2013-03-21 13:21:04 -07:00
|
|
|
} DebugTextVertexData;
|
|
|
|
|
|
2013-11-09 16:08:08 -08:00
|
|
|
KRDataBlock 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
|
|
|
};
|