CMake autodetecting boost.
Added KRDataBlock to CMakeLists
This commit is contained in:
@@ -71,6 +71,15 @@ PROPERTIES
|
|||||||
OUTPUT_NAME kraken
|
OUTPUT_NAME kraken
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(Boost_USE_STATIC_LIBS ON) # only find static libs
|
||||||
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
|
find_package(Boost 1.65.1)
|
||||||
|
if(Boost_FOUND)
|
||||||
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(kraken ${Boost_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
# add_custom_target(package
|
# add_custom_target(package
|
||||||
# COMMENT "Compressing..."
|
# COMMENT "Compressing..."
|
||||||
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/archive"
|
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/archive"
|
||||||
|
|||||||
@@ -11,3 +11,6 @@ add_sources(quaternion.cpp)
|
|||||||
add_sources(matrix4.cpp)
|
add_sources(matrix4.cpp)
|
||||||
add_sources(aabb.cpp)
|
add_sources(aabb.cpp)
|
||||||
add_sources(hitinfo.cpp)
|
add_sources(hitinfo.cpp)
|
||||||
|
|
||||||
|
# Private Implementation
|
||||||
|
add_sources(KRDataBlock.cpp)
|
||||||
|
|||||||
@@ -20,22 +20,22 @@ class KRAudioBuffer
|
|||||||
public:
|
public:
|
||||||
KRAudioBuffer(KRAudioManager *manager, KRAudioSample *sound, int index, int frameCount, int frameRate, int bytesPerFrame, void (*fn_populate)(KRAudioSample *, int, void *));
|
KRAudioBuffer(KRAudioManager *manager, KRAudioSample *sound, int index, int frameCount, int frameRate, int bytesPerFrame, void (*fn_populate)(KRAudioSample *, int, void *));
|
||||||
~KRAudioBuffer();
|
~KRAudioBuffer();
|
||||||
|
|
||||||
int getFrameCount();
|
int getFrameCount();
|
||||||
int getFrameRate();
|
int getFrameRate();
|
||||||
signed short *getFrameData();
|
signed short *getFrameData();
|
||||||
|
|
||||||
KRAudioSample *getAudioSample();
|
KRAudioSample *getAudioSample();
|
||||||
int getIndex();
|
int getIndex();
|
||||||
private:
|
private:
|
||||||
KRAudioManager *m_pSoundManager;
|
KRAudioManager *m_pSoundManager;
|
||||||
|
|
||||||
int m_index;
|
int m_index;
|
||||||
int m_frameCount;
|
int m_frameCount;
|
||||||
int m_frameRate;
|
int m_frameRate;
|
||||||
int m_bytesPerFrame;
|
int m_bytesPerFrame;
|
||||||
KRDataBlock *m_pData;
|
KRDataBlock *m_pData;
|
||||||
|
|
||||||
KRAudioSample *m_audioSample;
|
KRAudioSample *m_audioSample;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
This class is a pure-virtual base class intended to be subclassed to define behavior of KRNode's in the scene
|
This class is a pure-virtual base class intended to be subclassed to define behavior of KRNode's in the scene
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KRBehavior;
|
class KRBehavior;
|
||||||
@@ -31,16 +31,16 @@ class KRBehavior
|
|||||||
public:
|
public:
|
||||||
static void RegisterFactoryCTOR(std::string behaviorName, KRBehaviorFactoryFunction fnFactory);
|
static void RegisterFactoryCTOR(std::string behaviorName, KRBehaviorFactoryFunction fnFactory);
|
||||||
static void UnregisterFactoryCTOR(std::string behaviorName);
|
static void UnregisterFactoryCTOR(std::string behaviorName);
|
||||||
|
|
||||||
KRBehavior();
|
KRBehavior();
|
||||||
virtual ~KRBehavior();
|
virtual ~KRBehavior();
|
||||||
KRNode *getNode() const;
|
KRNode *getNode() const;
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void update(float deltaTime) = 0;
|
virtual void update(float deltaTime) = 0;
|
||||||
virtual void visibleUpdate(float deltatime) = 0;
|
virtual void visibleUpdate(float deltatime) = 0;
|
||||||
void __setNode(KRNode *node);
|
void __setNode(KRNode *node);
|
||||||
|
|
||||||
static KRBehavior *LoadXML(KRNode *node, tinyxml2::XMLElement *e);
|
static KRBehavior *LoadXML(KRNode *node, tinyxml2::XMLElement *e);
|
||||||
private:
|
private:
|
||||||
KRNode *__node;
|
KRNode *__node;
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ bool KRDataBlock::load(const std::string &path)
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
unload();
|
unload();
|
||||||
|
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
m_bReadOnly = true;
|
m_bReadOnly = true;
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ KRDataBlock *KRDataBlock::getSubBlock(int start, int length)
|
|||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
if(m_hPackFile) {
|
if(m_hPackFile) {
|
||||||
new_block->m_hPackFile = m_hPackFile;
|
new_block->m_hPackFile = m_hPackFile;
|
||||||
#elif defined(__APPLE)
|
#elif defined(__APPLE__)
|
||||||
if (m_fdPackFile) {
|
if (m_fdPackFile) {
|
||||||
new_block->m_fdPackFile = m_fdPackFile;
|
new_block->m_fdPackFile = m_fdPackFile;
|
||||||
#else
|
#else
|
||||||
@@ -237,10 +237,10 @@ void KRDataBlock::expand(size_t size)
|
|||||||
// ... Or starting with a pointer reference, we must make our own copy and must not free the pointer
|
// ... Or starting with a pointer reference, we must make our own copy and must not free the pointer
|
||||||
void *pNewData = malloc(m_data_size + size);
|
void *pNewData = malloc(m_data_size + size);
|
||||||
assert(pNewData != NULL);
|
assert(pNewData != NULL);
|
||||||
|
|
||||||
// Copy exising data
|
// Copy exising data
|
||||||
copy(pNewData);
|
copy(pNewData);
|
||||||
|
|
||||||
// Unload existing data allocation, which is now redundant
|
// Unload existing data allocation, which is now redundant
|
||||||
size_t new_size = m_data_size + size; // We need to store this before unload() as unload() will reset it
|
size_t new_size = m_data_size + size; // We need to store this before unload() as unload() will reset it
|
||||||
unload();
|
unload();
|
||||||
@@ -255,7 +255,7 @@ void KRDataBlock::expand(size_t size)
|
|||||||
void KRDataBlock::append(void *data, size_t size) {
|
void KRDataBlock::append(void *data, size_t size) {
|
||||||
// Expand the data block
|
// Expand the data block
|
||||||
expand(size);
|
expand(size);
|
||||||
|
|
||||||
// Fill the new space with the data to append
|
// Fill the new space with the data to append
|
||||||
lock();
|
lock();
|
||||||
memcpy((unsigned char *)m_data + m_data_size - size, data, size);
|
memcpy((unsigned char *)m_data + m_data_size - size, data, size);
|
||||||
@@ -326,7 +326,7 @@ bool KRDataBlock::save(const std::string& path) {
|
|||||||
HANDLE hNewFile = INVALID_HANDLE_VALUE;
|
HANDLE hNewFile = INVALID_HANDLE_VALUE;
|
||||||
HANDLE hFileMapping = NULL;
|
HANDLE hFileMapping = NULL;
|
||||||
void *pNewData = NULL;
|
void *pNewData = NULL;
|
||||||
|
|
||||||
hNewFile = CreateFile(path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
hNewFile = CreateFile(path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (hNewFile == INVALID_HANDLE_VALUE) {
|
if (hNewFile == INVALID_HANDLE_VALUE) {
|
||||||
success = false;
|
success = false;
|
||||||
@@ -364,7 +364,7 @@ bool KRDataBlock::save(const std::string& path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
int fdNewFile = open(path.c_str(), O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
|
int fdNewFile = open(path.c_str(), O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
|
||||||
if(fdNewFile == -1) {
|
if(fdNewFile == -1) {
|
||||||
@@ -374,7 +374,7 @@ bool KRDataBlock::save(const std::string& path) {
|
|||||||
// Seek to end of file and write a byte to enlarge it
|
// Seek to end of file and write a byte to enlarge it
|
||||||
lseek(fdNewFile, m_data_size-1, SEEK_SET);
|
lseek(fdNewFile, m_data_size-1, SEEK_SET);
|
||||||
write(fdNewFile, "", 1);
|
write(fdNewFile, "", 1);
|
||||||
|
|
||||||
// Now map it...
|
// Now map it...
|
||||||
void *pNewData = mmap(0, m_data_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdNewFile, 0);
|
void *pNewData = mmap(0, m_data_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdNewFile, 0);
|
||||||
if(pNewData == (caddr_t) -1) {
|
if(pNewData == (caddr_t) -1) {
|
||||||
@@ -384,10 +384,10 @@ bool KRDataBlock::save(const std::string& path) {
|
|||||||
if(m_data != NULL) {
|
if(m_data != NULL) {
|
||||||
// Copy data to new file
|
// Copy data to new file
|
||||||
copy(pNewData);
|
copy(pNewData);
|
||||||
|
|
||||||
// Unmap the new file
|
// Unmap the new file
|
||||||
munmap(pNewData, m_data_size);
|
munmap(pNewData, m_data_size);
|
||||||
|
|
||||||
// Close the new file
|
// Close the new file
|
||||||
close(fdNewFile);
|
close(fdNewFile);
|
||||||
}
|
}
|
||||||
@@ -414,7 +414,7 @@ std::string KRDataBlock::getString()
|
|||||||
void KRDataBlock::lock()
|
void KRDataBlock::lock()
|
||||||
{
|
{
|
||||||
if(m_lockCount == 0) {
|
if(m_lockCount == 0) {
|
||||||
|
|
||||||
// Memory mapped file; ensure data is mapped to ram
|
// Memory mapped file; ensure data is mapped to ram
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
if(m_hFileMapping) {
|
if(m_hFileMapping) {
|
||||||
@@ -439,7 +439,7 @@ void KRDataBlock::lock()
|
|||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
//fprintf(stderr, "KRDataBlock::lock - \"%s\" (%i)\n", m_fileOwnerDataBlock->m_fileName.c_str(), m_lockCount);
|
//fprintf(stderr, "KRDataBlock::lock - \"%s\" (%i)\n", m_fileOwnerDataBlock->m_fileName.c_str(), m_lockCount);
|
||||||
// Round m_data_offset down to the next memory page, as required by mmap
|
// Round m_data_offset down to the next memory page, as required by mmap
|
||||||
|
|
||||||
if ((m_mmapData = mmap(0, m_data_size + alignment_offset, m_bReadOnly ? PROT_READ : PROT_WRITE, MAP_SHARED, m_fdPackFile, m_data_offset - alignment_offset)) == (caddr_t) -1) {
|
if ((m_mmapData = mmap(0, m_data_size + alignment_offset, m_bReadOnly ? PROT_READ : PROT_WRITE, MAP_SHARED, m_fdPackFile, m_data_offset - alignment_offset)) == (caddr_t) -1) {
|
||||||
int iError = errno;
|
int iError = errno;
|
||||||
switch(iError) {
|
switch(iError) {
|
||||||
@@ -489,10 +489,10 @@ void KRDataBlock::unlock()
|
|||||||
{
|
{
|
||||||
// We expect that the data block was previously locked
|
// We expect that the data block was previously locked
|
||||||
assertLocked();
|
assertLocked();
|
||||||
|
|
||||||
|
|
||||||
if(m_lockCount == 1) {
|
if(m_lockCount == 1) {
|
||||||
|
|
||||||
// Memory mapped file; ensure data is unmapped from ram
|
// Memory mapped file; ensure data is unmapped from ram
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
if (m_hPackFile) {
|
if (m_hPackFile) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "public/kraken.h"
|
#include "public/kraken.h"
|
||||||
#include "KRHelpers.h"
|
#include "KRHelpers.h"
|
||||||
|
using namespace kraken;
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -30,8 +31,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
|
||||||
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@@ -51,7 +53,6 @@
|
|||||||
#include <OpenAL/MacOSX_OALExtensions.h>
|
#include <OpenAL/MacOSX_OALExtensions.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "tinyxml2.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/tokenizer.hpp>
|
#include <boost/tokenizer.hpp>
|
||||||
|
|||||||
119
kraken/KRMesh.h
119
kraken/KRMesh.h
@@ -3,17 +3,17 @@
|
|||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification, are
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
// permitted provided that the following conditions are met:
|
// permitted provided that the following conditions are met:
|
||||||
//
|
//
|
||||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
// conditions and the following disclaimer.
|
// conditions and the following disclaimer.
|
||||||
//
|
//
|
||||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
// 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
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
// provided with the distribution.
|
// provided with the distribution.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
// 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
|
// 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
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// 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
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// The views and conclusions contained in the software and documentation are those of the
|
// 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
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
// or implied, of Kearwood Gilbert.
|
// or implied, of Kearwood Gilbert.
|
||||||
@@ -51,26 +51,25 @@ using namespace kraken;
|
|||||||
#include "KRMaterialManager.h"
|
#include "KRMaterialManager.h"
|
||||||
#include "KRCamera.h"
|
#include "KRCamera.h"
|
||||||
#include "KRViewport.h"
|
#include "KRViewport.h"
|
||||||
#include "KRHitInfo.h"
|
|
||||||
|
|
||||||
class KRMaterial;
|
class KRMaterial;
|
||||||
class KRNode;
|
class KRNode;
|
||||||
|
|
||||||
class KRMesh : public KRResource {
|
class KRMesh : public KRResource {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
KRMesh(KRContext &context, std::string name, KRDataBlock *data);
|
KRMesh(KRContext &context, std::string name, KRDataBlock *data);
|
||||||
KRMesh(KRContext &context, std::string name);
|
KRMesh(KRContext &context, std::string name);
|
||||||
virtual ~KRMesh();
|
virtual ~KRMesh();
|
||||||
|
|
||||||
kraken_stream_level getStreamLevel();
|
kraken_stream_level getStreamLevel();
|
||||||
void preStream(float lodCoverage);
|
void preStream(float lodCoverage);
|
||||||
|
|
||||||
bool hasTransparency();
|
bool hasTransparency();
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
KRENGINE_ATTRIB_VERTEX = 0,
|
KRENGINE_ATTRIB_VERTEX = 0,
|
||||||
KRENGINE_ATTRIB_NORMAL,
|
KRENGINE_ATTRIB_NORMAL,
|
||||||
@@ -86,14 +85,14 @@ public:
|
|||||||
KRENGINE_ATTRIB_TEXUVB_SHORT,
|
KRENGINE_ATTRIB_TEXUVB_SHORT,
|
||||||
KRENGINE_NUM_ATTRIBUTES
|
KRENGINE_NUM_ATTRIBUTES
|
||||||
} vertex_attrib_t;
|
} vertex_attrib_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
KRENGINE_MODEL_FORMAT_TRIANGLES = 0,
|
KRENGINE_MODEL_FORMAT_TRIANGLES = 0,
|
||||||
KRENGINE_MODEL_FORMAT_STRIP,
|
KRENGINE_MODEL_FORMAT_STRIP,
|
||||||
KRENGINE_MODEL_FORMAT_INDEXED_TRIANGLES,
|
KRENGINE_MODEL_FORMAT_INDEXED_TRIANGLES,
|
||||||
KRENGINE_MODEL_FORMAT_INDEXED_STRIP
|
KRENGINE_MODEL_FORMAT_INDEXED_STRIP
|
||||||
} model_format_t;
|
} model_format_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
model_format_t format;
|
model_format_t format;
|
||||||
std::vector<Vector3> vertices;
|
std::vector<Vector3> vertices;
|
||||||
@@ -111,29 +110,29 @@ public:
|
|||||||
std::vector<Matrix4> bone_bind_poses;
|
std::vector<Matrix4> bone_bind_poses;
|
||||||
std::vector<std::vector<float> > bone_weights;
|
std::vector<std::vector<float> > bone_weights;
|
||||||
} mesh_info;
|
} mesh_info;
|
||||||
|
|
||||||
void render(const std::string &object_name, KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, const Matrix4 &matModel, KRTexture *pLightMap, KRNode::RenderPass renderPass, const std::vector<KRBone *> &bones, const Vector3 &rim_color, float rim_power, float lod_coverage = 0.0f);
|
void render(const std::string &object_name, KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, const Matrix4 &matModel, KRTexture *pLightMap, KRNode::RenderPass renderPass, const std::vector<KRBone *> &bones, const Vector3 &rim_color, float rim_power, float lod_coverage = 0.0f);
|
||||||
|
|
||||||
std::string m_lodBaseName;
|
std::string m_lodBaseName;
|
||||||
|
|
||||||
virtual std::string getExtension();
|
virtual std::string getExtension();
|
||||||
virtual bool save(const std::string& path);
|
virtual bool save(const std::string& path);
|
||||||
virtual bool save(KRDataBlock &data);
|
virtual bool save(KRDataBlock &data);
|
||||||
|
|
||||||
void LoadData(const mesh_info &mi, bool calculate_normals, bool calculate_tangents);
|
void LoadData(const mesh_info &mi, bool calculate_normals, bool calculate_tangents);
|
||||||
void loadPack(KRDataBlock *data);
|
void loadPack(KRDataBlock *data);
|
||||||
|
|
||||||
void convertToIndexed();
|
void convertToIndexed();
|
||||||
void optimize();
|
void optimize();
|
||||||
void optimizeIndexes();
|
void optimizeIndexes();
|
||||||
|
|
||||||
void renderSubmesh(int iSubmesh, KRNode::RenderPass renderPass, const std::string &object_name, const std::string &material_name, float lodCoverage);
|
void renderSubmesh(int iSubmesh, KRNode::RenderPass renderPass, const std::string &object_name, const std::string &material_name, float lodCoverage);
|
||||||
|
|
||||||
GLfloat getMaxDimension();
|
GLfloat getMaxDimension();
|
||||||
|
|
||||||
Vector3 getMinPoint() const;
|
Vector3 getMinPoint() const;
|
||||||
Vector3 getMaxPoint() const;
|
Vector3 getMaxPoint() const;
|
||||||
|
|
||||||
class Submesh {
|
class Submesh {
|
||||||
public:
|
public:
|
||||||
Submesh() {};
|
Submesh() {};
|
||||||
@@ -148,7 +147,7 @@ public:
|
|||||||
delete (*itr);
|
delete (*itr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GLint start_vertex;
|
GLint start_vertex;
|
||||||
GLsizei vertex_count;
|
GLsizei vertex_count;
|
||||||
char szMaterialName[KRENGINE_MAX_NAME_LENGTH];
|
char szMaterialName[KRENGINE_MAX_NAME_LENGTH];
|
||||||
@@ -168,7 +167,7 @@ public:
|
|||||||
int32_t vertex_count;
|
int32_t vertex_count;
|
||||||
char szName[KRENGINE_MAX_NAME_LENGTH];
|
char szName[KRENGINE_MAX_NAME_LENGTH];
|
||||||
} pack_material;
|
} pack_material;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char szName[KRENGINE_MAX_NAME_LENGTH];
|
char szName[KRENGINE_MAX_NAME_LENGTH];
|
||||||
float bind_pose[16];
|
float bind_pose[16];
|
||||||
@@ -176,12 +175,12 @@ public:
|
|||||||
|
|
||||||
int getLODCoverage() const;
|
int getLODCoverage() const;
|
||||||
std::string getLODBaseName() const;
|
std::string getLODBaseName() const;
|
||||||
|
|
||||||
|
|
||||||
static bool lod_sort_predicate(const KRMesh *m1, const KRMesh *m2);
|
static bool lod_sort_predicate(const KRMesh *m1, const KRMesh *m2);
|
||||||
bool has_vertex_attribute(vertex_attrib_t attribute_type) const;
|
bool has_vertex_attribute(vertex_attrib_t attribute_type) const;
|
||||||
static bool has_vertex_attribute(int vertex_attrib_flags, vertex_attrib_t attribute_type);
|
static bool has_vertex_attribute(int vertex_attrib_flags, vertex_attrib_t attribute_type);
|
||||||
|
|
||||||
int getSubmeshCount() const;
|
int getSubmeshCount() const;
|
||||||
int getVertexCount(int submesh) const;
|
int getVertexCount(int submesh) const;
|
||||||
int getTriangleVertexIndex(int submesh, int index) const;
|
int getTriangleVertexIndex(int submesh, int index) const;
|
||||||
@@ -192,7 +191,7 @@ public:
|
|||||||
Vector2 getVertexUVB(int index) const;
|
Vector2 getVertexUVB(int index) const;
|
||||||
int getBoneIndex(int index, int weight_index) const;
|
int getBoneIndex(int index, int weight_index) const;
|
||||||
float getBoneWeight(int index, int weight_index) const;
|
float getBoneWeight(int index, int weight_index) const;
|
||||||
|
|
||||||
void setVertexPosition(int index, const Vector3 &v);
|
void setVertexPosition(int index, const Vector3 &v);
|
||||||
void setVertexNormal(int index, const Vector3 &v);
|
void setVertexNormal(int index, const Vector3 &v);
|
||||||
void setVertexTangent(int index, const Vector3 & v);
|
void setVertexTangent(int index, const Vector3 & v);
|
||||||
@@ -200,51 +199,51 @@ public:
|
|||||||
void setVertexUVB(int index, const Vector2 &v);
|
void setVertexUVB(int index, const Vector2 &v);
|
||||||
void setBoneIndex(int index, int weight_index, int bone_index);
|
void setBoneIndex(int index, int weight_index, int bone_index);
|
||||||
void setBoneWeight(int index, int weight_index, float bone_weight);
|
void setBoneWeight(int index, int weight_index, float bone_weight);
|
||||||
|
|
||||||
static size_t VertexSizeForAttributes(__int32_t vertex_attrib_flags);
|
static size_t VertexSizeForAttributes(__int32_t vertex_attrib_flags);
|
||||||
static size_t AttributeOffset(__int32_t vertex_attrib, __int32_t vertex_attrib_flags);
|
static size_t AttributeOffset(__int32_t vertex_attrib, __int32_t vertex_attrib_flags);
|
||||||
|
|
||||||
int getBoneCount();
|
int getBoneCount();
|
||||||
char *getBoneName(int bone_index);
|
char *getBoneName(int bone_index);
|
||||||
Matrix4 getBoneBindPose(int bone_index);
|
Matrix4 getBoneBindPose(int bone_index);
|
||||||
|
|
||||||
|
|
||||||
model_format_t getModelFormat() const;
|
model_format_t getModelFormat() const;
|
||||||
|
|
||||||
bool lineCast(const Vector3 &v0, const Vector3 &v1, KRHitInfo &hitinfo) const;
|
bool lineCast(const Vector3 &v0, const Vector3 &v1, HitInfo &hitinfo) const;
|
||||||
bool rayCast(const Vector3 &v0, const Vector3 &dir, KRHitInfo &hitinfo) const;
|
bool rayCast(const Vector3 &v0, const Vector3 &dir, HitInfo &hitinfo) const;
|
||||||
bool sphereCast(const Matrix4 &model_to_world, const Vector3 &v0, const Vector3 &v1, float radius, KRHitInfo &hitinfo) const;
|
bool sphereCast(const Matrix4 &model_to_world, const Vector3 &v0, const Vector3 &v1, float radius, HitInfo &hitinfo) const;
|
||||||
|
|
||||||
static int GetLODCoverage(const std::string &name);
|
static int GetLODCoverage(const std::string &name);
|
||||||
|
|
||||||
void load(); // Load immediately into the GPU rather than passing through the streamer
|
void load(); // Load immediately into the GPU rather than passing through the streamer
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_constant; // TRUE if this should be always loaded and should not be passed through the streamer
|
bool m_constant; // TRUE if this should be always loaded and should not be passed through the streamer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KRDataBlock *m_pData;
|
KRDataBlock *m_pData;
|
||||||
KRDataBlock *m_pMetaData;
|
KRDataBlock *m_pMetaData;
|
||||||
KRDataBlock *m_pIndexBaseData;
|
KRDataBlock *m_pIndexBaseData;
|
||||||
|
|
||||||
void getSubmeshes();
|
void getSubmeshes();
|
||||||
void getMaterials();
|
void getMaterials();
|
||||||
|
|
||||||
static bool rayCast(const Vector3 &start, const Vector3 &dir, const Triangle3 &tri, const Vector3 &tri_n0, const Vector3 &tri_n1, const Vector3 &tri_n2, KRHitInfo &hitinfo);
|
static bool rayCast(const Vector3 &start, const Vector3 &dir, const Triangle3 &tri, const Vector3 &tri_n0, const Vector3 &tri_n1, const Vector3 &tri_n2, HitInfo &hitinfo);
|
||||||
static bool sphereCast(const Matrix4 &model_to_world, const Vector3 &v0, const Vector3 &v1, float radius, const Triangle3 &tri, KRHitInfo &hitinfo);
|
static bool sphereCast(const Matrix4 &model_to_world, const Vector3 &v0, const Vector3 &v1, float radius, const Triangle3 &tri, HitInfo &hitinfo);
|
||||||
|
|
||||||
int m_lodCoverage; // This LOD level is activated when the bounding box of the model will cover less than this percent of the screen (100 = highest detail model)
|
int m_lodCoverage; // This LOD level is activated when the bounding box of the model will cover less than this percent of the screen (100 = highest detail model)
|
||||||
vector<KRMaterial *> m_materials;
|
vector<KRMaterial *> m_materials;
|
||||||
set<KRMaterial *> m_uniqueMaterials;
|
set<KRMaterial *> m_uniqueMaterials;
|
||||||
|
|
||||||
bool m_hasTransparency;
|
bool m_hasTransparency;
|
||||||
|
|
||||||
|
|
||||||
Vector3 m_minPoint, m_maxPoint;
|
Vector3 m_minPoint, m_maxPoint;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char szTag[16];
|
char szTag[16];
|
||||||
int32_t model_format; // 0 == Triangle list, 1 == Triangle strips, 2 == Indexed triangle list, 3 == Indexed triangle strips, rest are reserved (model_format_t enum)
|
int32_t model_format; // 0 == Triangle list, 1 == Triangle strips, 2 == Indexed triangle list, 3 == Indexed triangle strips, rest are reserved (model_format_t enum)
|
||||||
@@ -257,16 +256,16 @@ private:
|
|||||||
int32_t index_base_count;
|
int32_t index_base_count;
|
||||||
unsigned char reserved[444]; // Pad out to 512 bytes
|
unsigned char reserved[444]; // Pad out to 512 bytes
|
||||||
} pack_header;
|
} pack_header;
|
||||||
|
|
||||||
vector<Submesh *> m_submeshes;
|
vector<Submesh *> m_submeshes;
|
||||||
int m_vertex_attribute_offset[KRENGINE_NUM_ATTRIBUTES];
|
int m_vertex_attribute_offset[KRENGINE_NUM_ATTRIBUTES];
|
||||||
int m_vertex_size;
|
int m_vertex_size;
|
||||||
void updateAttributeOffsets();
|
void updateAttributeOffsets();
|
||||||
|
|
||||||
void setName(const std::string name);
|
void setName(const std::string name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pack_material *getSubmesh(int mesh_index) const;
|
pack_material *getSubmesh(int mesh_index) const;
|
||||||
unsigned char *getVertexData() const;
|
unsigned char *getVertexData() const;
|
||||||
size_t getVertexDataOffset() const;
|
size_t getVertexDataOffset() const;
|
||||||
@@ -276,15 +275,15 @@ private:
|
|||||||
__uint32_t *getIndexBaseData() const;
|
__uint32_t *getIndexBaseData() const;
|
||||||
pack_header *getHeader() const;
|
pack_header *getHeader() const;
|
||||||
pack_bone *getBone(int index);
|
pack_bone *getBone(int index);
|
||||||
|
|
||||||
|
|
||||||
void getIndexedRange(int index_group, int &start_index_offset, int &start_vertex_offset, int &index_count, int &vertex_count) const;
|
void getIndexedRange(int index_group, int &start_index_offset, int &start_vertex_offset, int &index_count, int &vertex_count) const;
|
||||||
|
|
||||||
void releaseData();
|
void releaseData();
|
||||||
|
|
||||||
void createDataBlocks(KRMeshManager::KRVBOData::vbo_type t);
|
void createDataBlocks(KRMeshManager::KRVBOData::vbo_type t);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include "KREngine-common.h"
|
#include "KREngine-common.h"
|
||||||
#include "KROctreeNode.h"
|
#include "KROctreeNode.h"
|
||||||
#include "KRHitInfo.h"
|
|
||||||
|
|
||||||
class KRNode;
|
class KRNode;
|
||||||
|
|
||||||
@@ -19,22 +18,22 @@ class KROctree {
|
|||||||
public:
|
public:
|
||||||
KROctree();
|
KROctree();
|
||||||
~KROctree();
|
~KROctree();
|
||||||
|
|
||||||
void add(KRNode *pNode);
|
void add(KRNode *pNode);
|
||||||
void remove(KRNode *pNode);
|
void remove(KRNode *pNode);
|
||||||
void update(KRNode *pNode);
|
void update(KRNode *pNode);
|
||||||
|
|
||||||
KROctreeNode *getRootNode();
|
KROctreeNode *getRootNode();
|
||||||
std::set<KRNode *> &getOuterSceneNodes();
|
std::set<KRNode *> &getOuterSceneNodes();
|
||||||
|
|
||||||
bool lineCast(const Vector3 &v0, const Vector3 &v1, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool lineCast(const Vector3 &v0, const Vector3 &v1, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
bool rayCast(const Vector3 &v0, const Vector3 &dir, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool rayCast(const Vector3 &v0, const Vector3 &dir, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KROctreeNode *m_pRootNode;
|
KROctreeNode *m_pRootNode;
|
||||||
std::set<KRNode *> m_outerSceneNodes;
|
std::set<KRNode *> m_outerSceneNodes;
|
||||||
|
|
||||||
void shrink();
|
void shrink();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define KROCTREENODE_H
|
#define KROCTREENODE_H
|
||||||
|
|
||||||
#include "KREngine-common.h"
|
#include "KREngine-common.h"
|
||||||
#include "KRHitInfo.h"
|
#include "public/hitinfo.h"
|
||||||
|
|
||||||
class KRNode;
|
class KRNode;
|
||||||
|
|
||||||
@@ -19,45 +19,45 @@ public:
|
|||||||
KROctreeNode(KROctreeNode *parent, const AABB &bounds);
|
KROctreeNode(KROctreeNode *parent, const AABB &bounds);
|
||||||
KROctreeNode(KROctreeNode *parent, const AABB &bounds, int iChild, KROctreeNode *pChild);
|
KROctreeNode(KROctreeNode *parent, const AABB &bounds, int iChild, KROctreeNode *pChild);
|
||||||
~KROctreeNode();
|
~KROctreeNode();
|
||||||
|
|
||||||
KROctreeNode **getChildren();
|
KROctreeNode **getChildren();
|
||||||
std::set<KRNode *> &getSceneNodes();
|
std::set<KRNode *> &getSceneNodes();
|
||||||
|
|
||||||
void add(KRNode *pNode);
|
void add(KRNode *pNode);
|
||||||
void remove(KRNode *pNode);
|
void remove(KRNode *pNode);
|
||||||
void update(KRNode *pNode);
|
void update(KRNode *pNode);
|
||||||
|
|
||||||
AABB getBounds();
|
AABB getBounds();
|
||||||
|
|
||||||
KROctreeNode *getParent();
|
KROctreeNode *getParent();
|
||||||
void setChildNode(int iChild, KROctreeNode *pChild);
|
void setChildNode(int iChild, KROctreeNode *pChild);
|
||||||
int getChildIndex(KRNode *pNode);
|
int getChildIndex(KRNode *pNode);
|
||||||
AABB getChildBounds(int iChild);
|
AABB getChildBounds(int iChild);
|
||||||
void trim();
|
void trim();
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
bool canShrinkRoot() const;
|
bool canShrinkRoot() const;
|
||||||
KROctreeNode *stripChild();
|
KROctreeNode *stripChild();
|
||||||
|
|
||||||
void beginOcclusionQuery();
|
void beginOcclusionQuery();
|
||||||
void endOcclusionQuery();
|
void endOcclusionQuery();
|
||||||
|
|
||||||
|
|
||||||
GLuint m_occlusionQuery;
|
GLuint m_occlusionQuery;
|
||||||
bool m_occlusionTested;
|
bool m_occlusionTested;
|
||||||
bool m_activeQuery;
|
bool m_activeQuery;
|
||||||
|
|
||||||
bool lineCast(const Vector3 &v0, const Vector3 &v1, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool lineCast(const Vector3 &v0, const Vector3 &v1, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
bool rayCast(const Vector3 &v0, const Vector3 &dir, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool rayCast(const Vector3 &v0, const Vector3 &dir, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
AABB m_bounds;
|
AABB m_bounds;
|
||||||
|
|
||||||
KROctreeNode *m_parent;
|
KROctreeNode *m_parent;
|
||||||
KROctreeNode *m_children[8];
|
KROctreeNode *m_children[8];
|
||||||
|
|
||||||
std::set<KRNode *>m_sceneNodes;
|
std::set<KRNode *>m_sceneNodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification, are
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
// permitted provided that the following conditions are met:
|
// permitted provided that the following conditions are met:
|
||||||
//
|
//
|
||||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
// conditions and the following disclaimer.
|
// conditions and the following disclaimer.
|
||||||
//
|
//
|
||||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
// 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
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
// provided with the distribution.
|
// provided with the distribution.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
// 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
|
// 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
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// 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
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// The views and conclusions contained in the software and documentation are those of the
|
// 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
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
// or implied, of Kearwood Gilbert.
|
// or implied, of Kearwood Gilbert.
|
||||||
@@ -52,71 +52,71 @@ class KRScene : public KRResource {
|
|||||||
public:
|
public:
|
||||||
KRScene(KRContext &context, std::string name);
|
KRScene(KRContext &context, std::string name);
|
||||||
virtual ~KRScene();
|
virtual ~KRScene();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual std::string getExtension();
|
virtual std::string getExtension();
|
||||||
virtual bool save(KRDataBlock &data);
|
virtual bool save(KRDataBlock &data);
|
||||||
|
|
||||||
static KRScene *Load(KRContext &context, const std::string &name, KRDataBlock *data);
|
static KRScene *Load(KRContext &context, const std::string &name, KRDataBlock *data);
|
||||||
|
|
||||||
KRNode *getRootNode();
|
KRNode *getRootNode();
|
||||||
KRLight *getFirstLight();
|
KRLight *getFirstLight();
|
||||||
|
|
||||||
kraken_stream_level getStreamLevel();
|
kraken_stream_level getStreamLevel();
|
||||||
|
|
||||||
bool lineCast(const Vector3 &v0, const Vector3 &v1, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool lineCast(const Vector3 &v0, const Vector3 &v1, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
bool rayCast(const Vector3 &v0, const Vector3 &dir, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool rayCast(const Vector3 &v0, const Vector3 &dir, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, KRHitInfo &hitinfo, unsigned int layer_mask);
|
bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, HitInfo &hitinfo, unsigned int layer_mask);
|
||||||
|
|
||||||
void renderFrame(GLint defaultFBO, float deltaTime, int width, int height);
|
void renderFrame(GLint defaultFBO, float deltaTime, int width, int height);
|
||||||
void render(KRCamera *pCamera, unordered_map<AABB, int> &visibleBounds, const KRViewport &viewport, KRNode::RenderPass renderPass, bool new_frame);
|
void render(KRCamera *pCamera, unordered_map<AABB, int> &visibleBounds, const KRViewport &viewport, KRNode::RenderPass renderPass, bool new_frame);
|
||||||
|
|
||||||
void render(KROctreeNode *pOctreeNode, unordered_map<AABB, int> &visibleBounds, KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass, std::vector<KROctreeNode *> &remainingOctrees, std::vector<KROctreeNode *> &remainingOctreesTestResults, std::vector<KROctreeNode *> &remainingOctreesTestResultsOnly, bool bOcclusionResultsPass, bool bOcclusionTestResultsOnly);
|
void render(KROctreeNode *pOctreeNode, unordered_map<AABB, int> &visibleBounds, KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass, std::vector<KROctreeNode *> &remainingOctrees, std::vector<KROctreeNode *> &remainingOctreesTestResults, std::vector<KROctreeNode *> &remainingOctreesTestResultsOnly, bool bOcclusionResultsPass, bool bOcclusionTestResultsOnly);
|
||||||
|
|
||||||
void updateOctree(const KRViewport &viewport);
|
void updateOctree(const KRViewport &viewport);
|
||||||
void buildOctreeForTheFirstTime();
|
void buildOctreeForTheFirstTime();
|
||||||
|
|
||||||
void notify_sceneGraphCreate(KRNode *pNode);
|
void notify_sceneGraphCreate(KRNode *pNode);
|
||||||
void notify_sceneGraphDelete(KRNode *pNode);
|
void notify_sceneGraphDelete(KRNode *pNode);
|
||||||
void notify_sceneGraphModify(KRNode *pNode);
|
void notify_sceneGraphModify(KRNode *pNode);
|
||||||
|
|
||||||
void physicsUpdate(float deltaTime);
|
void physicsUpdate(float deltaTime);
|
||||||
void addDefaultLights();
|
void addDefaultLights();
|
||||||
|
|
||||||
AABB getRootOctreeBounds();
|
AABB getRootOctreeBounds();
|
||||||
|
|
||||||
std::set<KRAmbientZone *> &getAmbientZones();
|
std::set<KRAmbientZone *> &getAmbientZones();
|
||||||
std::set<KRReverbZone *> &getReverbZones();
|
std::set<KRReverbZone *> &getReverbZones();
|
||||||
std::set<KRLocator *> &getLocators();
|
std::set<KRLocator *> &getLocators();
|
||||||
std::set<KRLight *> &getLights();
|
std::set<KRLight *> &getLights();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
KRNode *m_pRootNode;
|
KRNode *m_pRootNode;
|
||||||
KRLight *m_pFirstLight;
|
KRLight *m_pFirstLight;
|
||||||
|
|
||||||
std::set<KRNode *> m_newNodes;
|
std::set<KRNode *> m_newNodes;
|
||||||
std::set<KRNode *> m_modifiedNodes;
|
std::set<KRNode *> m_modifiedNodes;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::set<KRNode *> m_physicsNodes;
|
std::set<KRNode *> m_physicsNodes;
|
||||||
std::set<KRAmbientZone *> m_ambientZoneNodes;
|
std::set<KRAmbientZone *> m_ambientZoneNodes;
|
||||||
std::set<KRReverbZone *> m_reverbZoneNodes;
|
std::set<KRReverbZone *> m_reverbZoneNodes;
|
||||||
std::set<KRLocator *> m_locatorNodes;
|
std::set<KRLocator *> m_locatorNodes;
|
||||||
std::set<KRLight *> m_lights;
|
std::set<KRLight *> m_lights;
|
||||||
|
|
||||||
KROctree m_nodeTree;
|
KROctree m_nodeTree;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
template <class T> T *find()
|
template <class T> T *find()
|
||||||
{
|
{
|
||||||
if(m_pRootNode) return m_pRootNode->find<T>();
|
if(m_pRootNode) return m_pRootNode->find<T>();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> T *find(const std::string &name)
|
template <class T> T *find(const std::string &name)
|
||||||
{
|
{
|
||||||
if(m_pRootNode) return m_pRootNode->find<T>(name);
|
if(m_pRootNode) return m_pRootNode->find<T>(name);
|
||||||
|
|||||||
@@ -34,10 +34,10 @@
|
|||||||
|
|
||||||
#include "vector3.h"
|
#include "vector3.h"
|
||||||
|
|
||||||
namespace kraken {
|
|
||||||
|
|
||||||
class KRNode;
|
class KRNode;
|
||||||
|
|
||||||
|
namespace kraken {
|
||||||
|
|
||||||
class HitInfo {
|
class HitInfo {
|
||||||
public:
|
public:
|
||||||
HitInfo();
|
HitInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user