From 4d85c2e3beae673cca4c200dd3735f265bb2b4c2 Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Mon, 30 Oct 2017 20:58:14 -0700 Subject: [PATCH] CMake autodetecting boost. Added KRDataBlock to CMakeLists --- CMakeLists.txt | 9 +++ kraken/CMakeLists.txt | 3 + kraken/KRAudioBuffer.h | 10 ++-- kraken/KRBehavior.h | 8 +-- kraken/KRDataBlock.cpp | 30 +++++----- kraken/KREngine-common.h | 5 +- kraken/KRMesh.h | 119 +++++++++++++++++++-------------------- kraken/KROctree.h | 15 +++-- kraken/KROctreeNode.h | 32 +++++------ kraken/KRScene.h | 62 ++++++++++---------- kraken/public/hitinfo.h | 4 +- 11 files changed, 154 insertions(+), 143 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0352b6..8e97d7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,15 @@ PROPERTIES 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 # COMMENT "Compressing..." # WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/archive" diff --git a/kraken/CMakeLists.txt b/kraken/CMakeLists.txt index 37042f7..05d0a68 100644 --- a/kraken/CMakeLists.txt +++ b/kraken/CMakeLists.txt @@ -11,3 +11,6 @@ add_sources(quaternion.cpp) add_sources(matrix4.cpp) add_sources(aabb.cpp) add_sources(hitinfo.cpp) + +# Private Implementation +add_sources(KRDataBlock.cpp) diff --git a/kraken/KRAudioBuffer.h b/kraken/KRAudioBuffer.h index c85f1e7..63d2459 100755 --- a/kraken/KRAudioBuffer.h +++ b/kraken/KRAudioBuffer.h @@ -20,22 +20,22 @@ class KRAudioBuffer public: KRAudioBuffer(KRAudioManager *manager, KRAudioSample *sound, int index, int frameCount, int frameRate, int bytesPerFrame, void (*fn_populate)(KRAudioSample *, int, void *)); ~KRAudioBuffer(); - + int getFrameCount(); int getFrameRate(); signed short *getFrameData(); - + KRAudioSample *getAudioSample(); int getIndex(); private: KRAudioManager *m_pSoundManager; - + int m_index; - int m_frameCount; + int m_frameCount; int m_frameRate; int m_bytesPerFrame; KRDataBlock *m_pData; - + KRAudioSample *m_audioSample; }; diff --git a/kraken/KRBehavior.h b/kraken/KRBehavior.h index 47835e1..050721d 100755 --- a/kraken/KRBehavior.h +++ b/kraken/KRBehavior.h @@ -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 - + */ class KRBehavior; @@ -31,16 +31,16 @@ class KRBehavior public: static void RegisterFactoryCTOR(std::string behaviorName, KRBehaviorFactoryFunction fnFactory); static void UnregisterFactoryCTOR(std::string behaviorName); - + KRBehavior(); virtual ~KRBehavior(); KRNode *getNode() const; - + virtual void init(); virtual void update(float deltaTime) = 0; virtual void visibleUpdate(float deltatime) = 0; void __setNode(KRNode *node); - + static KRBehavior *LoadXML(KRNode *node, tinyxml2::XMLElement *e); private: KRNode *__node; diff --git a/kraken/KRDataBlock.cpp b/kraken/KRDataBlock.cpp index 16ae790..769b22d 100755 --- a/kraken/KRDataBlock.cpp +++ b/kraken/KRDataBlock.cpp @@ -135,7 +135,7 @@ bool KRDataBlock::load(const std::string &path) { bool success = false; unload(); - + struct stat statbuf; m_bReadOnly = true; @@ -179,7 +179,7 @@ KRDataBlock *KRDataBlock::getSubBlock(int start, int length) #if defined(_WIN32) || defined(_WIN64) if(m_hPackFile) { new_block->m_hPackFile = m_hPackFile; -#elif defined(__APPLE) +#elif defined(__APPLE__) if (m_fdPackFile) { new_block->m_fdPackFile = m_fdPackFile; #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 void *pNewData = malloc(m_data_size + size); assert(pNewData != NULL); - + // Copy exising data copy(pNewData); - + // 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 unload(); @@ -255,7 +255,7 @@ void KRDataBlock::expand(size_t size) void KRDataBlock::append(void *data, size_t size) { // Expand the data block expand(size); - + // Fill the new space with the data to append lock(); 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 hFileMapping = NULL; void *pNewData = NULL; - + hNewFile = CreateFile(path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hNewFile == INVALID_HANDLE_VALUE) { success = false; @@ -364,7 +364,7 @@ bool KRDataBlock::save(const std::string& path) { } return success; - + #elif defined(__APPLE__) int fdNewFile = open(path.c_str(), O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600); 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 lseek(fdNewFile, m_data_size-1, SEEK_SET); write(fdNewFile, "", 1); - + // Now map it... void *pNewData = mmap(0, m_data_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdNewFile, 0); if(pNewData == (caddr_t) -1) { @@ -384,10 +384,10 @@ bool KRDataBlock::save(const std::string& path) { if(m_data != NULL) { // Copy data to new file copy(pNewData); - + // Unmap the new file munmap(pNewData, m_data_size); - + // Close the new file close(fdNewFile); } @@ -414,7 +414,7 @@ std::string KRDataBlock::getString() void KRDataBlock::lock() { if(m_lockCount == 0) { - + // Memory mapped file; ensure data is mapped to ram #if defined(_WIN32) || defined(_WIN64) if(m_hFileMapping) { @@ -439,7 +439,7 @@ void KRDataBlock::lock() #elif defined(__APPLE__) //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 - + 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; switch(iError) { @@ -489,10 +489,10 @@ void KRDataBlock::unlock() { // We expect that the data block was previously locked assertLocked(); - - + + if(m_lockCount == 1) { - + // Memory mapped file; ensure data is unmapped from ram #if defined(_WIN32) || defined(_WIN64) if (m_hPackFile) { diff --git a/kraken/KREngine-common.h b/kraken/KREngine-common.h index 76954a6..cb2da62 100755 --- a/kraken/KREngine-common.h +++ b/kraken/KREngine-common.h @@ -13,6 +13,7 @@ #include "public/kraken.h" #include "KRHelpers.h" +using namespace kraken; #include #include @@ -30,8 +31,9 @@ #include #include -#if defined(_WIN32) || defined(_WIN64) #include "../3rdparty/tinyxml2/tinyxml2.h" +#if defined(_WIN32) || defined(_WIN64) + #else #include @@ -51,7 +53,6 @@ #include #endif -#include "tinyxml2.h" #endif #include diff --git a/kraken/KRMesh.h b/kraken/KRMesh.h index a4c0ab4..a83217d 100755 --- a/kraken/KRMesh.h +++ b/kraken/KRMesh.h @@ -3,17 +3,17 @@ // KREngine // // Copyright 2012 Kearwood Gilbert. All rights reserved. -// +// // 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 @@ -23,7 +23,7 @@ // 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. @@ -51,26 +51,25 @@ using namespace kraken; #include "KRMaterialManager.h" #include "KRCamera.h" #include "KRViewport.h" -#include "KRHitInfo.h" class KRMaterial; class KRNode; class KRMesh : public KRResource { - + public: - - + + KRMesh(KRContext &context, std::string name, KRDataBlock *data); KRMesh(KRContext &context, std::string name); virtual ~KRMesh(); - + kraken_stream_level getStreamLevel(); void preStream(float lodCoverage); - + bool hasTransparency(); - + typedef enum { KRENGINE_ATTRIB_VERTEX = 0, KRENGINE_ATTRIB_NORMAL, @@ -86,14 +85,14 @@ public: KRENGINE_ATTRIB_TEXUVB_SHORT, KRENGINE_NUM_ATTRIBUTES } vertex_attrib_t; - + typedef enum { KRENGINE_MODEL_FORMAT_TRIANGLES = 0, KRENGINE_MODEL_FORMAT_STRIP, KRENGINE_MODEL_FORMAT_INDEXED_TRIANGLES, KRENGINE_MODEL_FORMAT_INDEXED_STRIP } model_format_t; - + typedef struct { model_format_t format; std::vector vertices; @@ -111,29 +110,29 @@ public: std::vector bone_bind_poses; std::vector > bone_weights; } mesh_info; - + void render(const std::string &object_name, KRCamera *pCamera, std::vector &point_lights, std::vector &directional_lights, std::vector&spot_lights, const KRViewport &viewport, const Matrix4 &matModel, KRTexture *pLightMap, KRNode::RenderPass renderPass, const std::vector &bones, const Vector3 &rim_color, float rim_power, float lod_coverage = 0.0f); - + std::string m_lodBaseName; - + virtual std::string getExtension(); virtual bool save(const std::string& path); virtual bool save(KRDataBlock &data); - + void LoadData(const mesh_info &mi, bool calculate_normals, bool calculate_tangents); void loadPack(KRDataBlock *data); - + void convertToIndexed(); void optimize(); void optimizeIndexes(); - + void renderSubmesh(int iSubmesh, KRNode::RenderPass renderPass, const std::string &object_name, const std::string &material_name, float lodCoverage); - + GLfloat getMaxDimension(); - + Vector3 getMinPoint() const; Vector3 getMaxPoint() const; - + class Submesh { public: Submesh() {}; @@ -148,7 +147,7 @@ public: delete (*itr); } }; - + GLint start_vertex; GLsizei vertex_count; char szMaterialName[KRENGINE_MAX_NAME_LENGTH]; @@ -168,7 +167,7 @@ public: int32_t vertex_count; char szName[KRENGINE_MAX_NAME_LENGTH]; } pack_material; - + typedef struct { char szName[KRENGINE_MAX_NAME_LENGTH]; float bind_pose[16]; @@ -176,12 +175,12 @@ public: int getLODCoverage() const; std::string getLODBaseName() const; - - + + static bool lod_sort_predicate(const KRMesh *m1, const KRMesh *m2); bool has_vertex_attribute(vertex_attrib_t attribute_type) const; static bool has_vertex_attribute(int vertex_attrib_flags, vertex_attrib_t attribute_type); - + int getSubmeshCount() const; int getVertexCount(int submesh) const; int getTriangleVertexIndex(int submesh, int index) const; @@ -192,7 +191,7 @@ public: Vector2 getVertexUVB(int index) const; int getBoneIndex(int index, int weight_index) const; float getBoneWeight(int index, int weight_index) const; - + void setVertexPosition(int index, const Vector3 &v); void setVertexNormal(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 setBoneIndex(int index, int weight_index, int bone_index); void setBoneWeight(int index, int weight_index, float bone_weight); - + static size_t VertexSizeForAttributes(__int32_t vertex_attrib_flags); static size_t AttributeOffset(__int32_t vertex_attrib, __int32_t vertex_attrib_flags); - + int getBoneCount(); char *getBoneName(int bone_index); Matrix4 getBoneBindPose(int bone_index); - + model_format_t getModelFormat() const; - - bool lineCast(const Vector3 &v0, const Vector3 &v1, KRHitInfo &hitinfo) const; - bool rayCast(const Vector3 &v0, const Vector3 &dir, KRHitInfo &hitinfo) const; - bool sphereCast(const Matrix4 &model_to_world, const Vector3 &v0, const Vector3 &v1, float radius, KRHitInfo &hitinfo) const; - + + bool lineCast(const Vector3 &v0, const Vector3 &v1, HitInfo &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, HitInfo &hitinfo) const; + static int GetLODCoverage(const std::string &name); - + void load(); // Load immediately into the GPU rather than passing through the streamer - + protected: bool m_constant; // TRUE if this should be always loaded and should not be passed through the streamer - + private: KRDataBlock *m_pData; KRDataBlock *m_pMetaData; KRDataBlock *m_pIndexBaseData; - + void getSubmeshes(); 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 sphereCast(const Matrix4 &model_to_world, const Vector3 &v0, const Vector3 &v1, float radius, const Triangle3 &tri, 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, 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) vector m_materials; set m_uniqueMaterials; - + bool m_hasTransparency; - - + + Vector3 m_minPoint, m_maxPoint; - - + + typedef struct { 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) @@ -257,16 +256,16 @@ private: int32_t index_base_count; unsigned char reserved[444]; // Pad out to 512 bytes } pack_header; - + vector m_submeshes; int m_vertex_attribute_offset[KRENGINE_NUM_ATTRIBUTES]; int m_vertex_size; void updateAttributeOffsets(); - + void setName(const std::string name); - - - + + + pack_material *getSubmesh(int mesh_index) const; unsigned char *getVertexData() const; size_t getVertexDataOffset() const; @@ -276,15 +275,15 @@ private: __uint32_t *getIndexBaseData() const; pack_header *getHeader() const; 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 releaseData(); - + void createDataBlocks(KRMeshManager::KRVBOData::vbo_type t); - + }; diff --git a/kraken/KROctree.h b/kraken/KROctree.h index 1e60fc3..082e922 100755 --- a/kraken/KROctree.h +++ b/kraken/KROctree.h @@ -11,7 +11,6 @@ #include "KREngine-common.h" #include "KROctreeNode.h" -#include "KRHitInfo.h" class KRNode; @@ -19,22 +18,22 @@ class KROctree { public: KROctree(); ~KROctree(); - + void add(KRNode *pNode); void remove(KRNode *pNode); void update(KRNode *pNode); - + KROctreeNode *getRootNode(); std::set &getOuterSceneNodes(); - - bool lineCast(const Vector3 &v0, const Vector3 &v1, KRHitInfo &hitinfo, unsigned int layer_mask); - bool rayCast(const Vector3 &v0, const Vector3 &dir, KRHitInfo &hitinfo, unsigned int layer_mask); - bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, 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, HitInfo &hitinfo, unsigned int layer_mask); + bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, HitInfo &hitinfo, unsigned int layer_mask); private: KROctreeNode *m_pRootNode; std::set m_outerSceneNodes; - + void shrink(); }; diff --git a/kraken/KROctreeNode.h b/kraken/KROctreeNode.h index 8630022..06b7ac7 100755 --- a/kraken/KROctreeNode.h +++ b/kraken/KROctreeNode.h @@ -10,7 +10,7 @@ #define KROCTREENODE_H #include "KREngine-common.h" -#include "KRHitInfo.h" +#include "public/hitinfo.h" class KRNode; @@ -19,45 +19,45 @@ public: KROctreeNode(KROctreeNode *parent, const AABB &bounds); KROctreeNode(KROctreeNode *parent, const AABB &bounds, int iChild, KROctreeNode *pChild); ~KROctreeNode(); - + KROctreeNode **getChildren(); std::set &getSceneNodes(); - + void add(KRNode *pNode); void remove(KRNode *pNode); void update(KRNode *pNode); - + AABB getBounds(); - + KROctreeNode *getParent(); void setChildNode(int iChild, KROctreeNode *pChild); int getChildIndex(KRNode *pNode); AABB getChildBounds(int iChild); void trim(); bool isEmpty() const; - + bool canShrinkRoot() const; KROctreeNode *stripChild(); - + void beginOcclusionQuery(); void endOcclusionQuery(); - - + + GLuint m_occlusionQuery; bool m_occlusionTested; bool m_activeQuery; - - bool lineCast(const Vector3 &v0, const Vector3 &v1, KRHitInfo &hitinfo, unsigned int layer_mask); - bool rayCast(const Vector3 &v0, const Vector3 &dir, KRHitInfo &hitinfo, unsigned int layer_mask); - bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, 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, HitInfo &hitinfo, unsigned int layer_mask); + bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, HitInfo &hitinfo, unsigned int layer_mask); private: - + AABB m_bounds; - + KROctreeNode *m_parent; KROctreeNode *m_children[8]; - + std::setm_sceneNodes; }; diff --git a/kraken/KRScene.h b/kraken/KRScene.h index 39bfa66..a0677df 100755 --- a/kraken/KRScene.h +++ b/kraken/KRScene.h @@ -3,17 +3,17 @@ // KREngine // // Copyright 2012 Kearwood Gilbert. All rights reserved. -// +// // 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 @@ -23,7 +23,7 @@ // 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. @@ -52,71 +52,71 @@ class KRScene : public KRResource { public: KRScene(KRContext &context, std::string name); virtual ~KRScene(); - - - + + + virtual std::string getExtension(); virtual bool save(KRDataBlock &data); - + static KRScene *Load(KRContext &context, const std::string &name, KRDataBlock *data); - + KRNode *getRootNode(); KRLight *getFirstLight(); - + kraken_stream_level getStreamLevel(); - - bool lineCast(const Vector3 &v0, const Vector3 &v1, KRHitInfo &hitinfo, unsigned int layer_mask); - bool rayCast(const Vector3 &v0, const Vector3 &dir, KRHitInfo &hitinfo, unsigned int layer_mask); - bool sphereCast(const Vector3 &v0, const Vector3 &v1, float radius, 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, HitInfo &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 render(KRCamera *pCamera, unordered_map &visibleBounds, const KRViewport &viewport, KRNode::RenderPass renderPass, bool new_frame); - + void render(KROctreeNode *pOctreeNode, unordered_map &visibleBounds, KRCamera *pCamera, std::vector &point_lights, std::vector &directional_lights, std::vector&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass, std::vector &remainingOctrees, std::vector &remainingOctreesTestResults, std::vector &remainingOctreesTestResultsOnly, bool bOcclusionResultsPass, bool bOcclusionTestResultsOnly); - + void updateOctree(const KRViewport &viewport); void buildOctreeForTheFirstTime(); - + void notify_sceneGraphCreate(KRNode *pNode); void notify_sceneGraphDelete(KRNode *pNode); void notify_sceneGraphModify(KRNode *pNode); - + void physicsUpdate(float deltaTime); void addDefaultLights(); - + AABB getRootOctreeBounds(); - + std::set &getAmbientZones(); std::set &getReverbZones(); std::set &getLocators(); std::set &getLights(); - + private: KRNode *m_pRootNode; KRLight *m_pFirstLight; - + std::set m_newNodes; std::set m_modifiedNodes; - - - + + + std::set m_physicsNodes; std::set m_ambientZoneNodes; std::set m_reverbZoneNodes; std::set m_locatorNodes; std::set m_lights; - + KROctree m_nodeTree; - + public: - + template T *find() { if(m_pRootNode) return m_pRootNode->find(); return NULL; } - + template T *find(const std::string &name) { if(m_pRootNode) return m_pRootNode->find(name); diff --git a/kraken/public/hitinfo.h b/kraken/public/hitinfo.h index b4fec14..1565900 100755 --- a/kraken/public/hitinfo.h +++ b/kraken/public/hitinfo.h @@ -34,10 +34,10 @@ #include "vector3.h" -namespace kraken { - class KRNode; +namespace kraken { + class HitInfo { public: HitInfo();