More CMake conversion, compile fixes
This commit is contained in:
@@ -48,10 +48,12 @@ IF(APPLE)
|
|||||||
FIND_LIBRARY(APPKIT_LIBRARY AppKit)
|
FIND_LIBRARY(APPKIT_LIBRARY AppKit)
|
||||||
FIND_LIBRARY(OPENGL_LIBRARY OpenGL)
|
FIND_LIBRARY(OPENGL_LIBRARY OpenGL)
|
||||||
FIND_LIBRARY(AUDIO_TOOLBOX_LIBRARY AudioToolbox)
|
FIND_LIBRARY(AUDIO_TOOLBOX_LIBRARY AudioToolbox)
|
||||||
|
FIND_LIBRARY(ACCELERATE_LIBRARY Accelerate)
|
||||||
MARK_AS_ADVANCED (APPKIT_LIBRARY
|
MARK_AS_ADVANCED (APPKIT_LIBRARY
|
||||||
OPENGL_LIBRARY
|
OPENGL_LIBRARY
|
||||||
AUDIO_TOOLBOX_LIBRARY)
|
AUDIO_TOOLBOX_LIBRARY
|
||||||
SET(EXTRA_LIBS ${APPKIT_LIBRARY} ${OPENGL_LIBRARY} ${AUDIO_TOOLBOX_LIBRARY})
|
ACCELERATE_LIBRARY)
|
||||||
|
SET(EXTRA_LIBS ${APPKIT_LIBRARY} ${OPENGL_LIBRARY} ${AUDIO_TOOLBOX_LIBRARY} ${ACCELERATE_LIBRARY})
|
||||||
FIND_PATH(COCOA_INCLUDE_DIR OpenGL/gl3.h)
|
FIND_PATH(COCOA_INCLUDE_DIR OpenGL/gl3.h)
|
||||||
ENDIF (APPLE)
|
ENDIF (APPLE)
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ add_sources(KRAudioManager.cpp)
|
|||||||
add_sources(KRAudioSample.cpp)
|
add_sources(KRAudioSample.cpp)
|
||||||
add_sources(KRAudioSource.cpp)
|
add_sources(KRAudioSource.cpp)
|
||||||
add_sources(KRBehavior.cpp)
|
add_sources(KRBehavior.cpp)
|
||||||
add_sources(KRDataBlock.cpp)
|
|
||||||
add_sources(KRBone.cpp)
|
add_sources(KRBone.cpp)
|
||||||
add_sources(KRBundle.cpp)
|
add_sources(KRBundle.cpp)
|
||||||
add_sources(KRBundleManager.cpp)
|
add_sources(KRBundleManager.cpp)
|
||||||
@@ -33,9 +32,62 @@ add_sources(KRCamera.cpp)
|
|||||||
add_sources(KRCollider.cpp)
|
add_sources(KRCollider.cpp)
|
||||||
add_sources(KRContext.cpp)
|
add_sources(KRContext.cpp)
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
|
add_sources(KREngine.mm)
|
||||||
|
add_sources(KRStreamer.mm)
|
||||||
|
add_sources(KRMeshStreamer.mm)
|
||||||
|
add_sources(KRTextureStreamer.mm)
|
||||||
IF(IOS)
|
IF(IOS)
|
||||||
add_sources(KRContext_ios.mm)
|
add_sources(KRContext_ios.mm)
|
||||||
ELSE()
|
ELSE()
|
||||||
add_sources(KRContext_osx.mm)
|
add_sources(KRContext_osx.mm)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF (APPLE)
|
ENDIF (APPLE)
|
||||||
|
add_sources(KRContextObject.cpp)
|
||||||
|
add_sources(KRDataBlock.cpp)
|
||||||
|
add_sources(KRDirectionalLight.cpp)
|
||||||
|
IF(APPLE)
|
||||||
|
add_sources(KRDSP_vDSP.cpp)
|
||||||
|
ELSE()
|
||||||
|
add_sources(KRDSP_slow.cpp)
|
||||||
|
ENDIF()
|
||||||
|
add_sources(KRHelpers.cpp)
|
||||||
|
add_sources(KRLight.cpp)
|
||||||
|
add_sources(KRLocator.cpp)
|
||||||
|
add_sources(KRLODGroup.cpp)
|
||||||
|
add_sources(KRLODSet.cpp)
|
||||||
|
add_sources(KRMaterial.cpp)
|
||||||
|
add_sources(KRMaterialManager.cpp)
|
||||||
|
add_sources(KRMesh.cpp)
|
||||||
|
add_sources(KRMeshCube.cpp)
|
||||||
|
add_sources(KRMeshManager.cpp)
|
||||||
|
add_sources(KRMeshQuad.cpp)
|
||||||
|
add_sources(KRMeshSphere.cpp)
|
||||||
|
add_sources(KRModel.cpp)
|
||||||
|
add_sources(KRNode.cpp)
|
||||||
|
add_sources(KROctree.cpp)
|
||||||
|
add_sources(KROctreeNode.cpp)
|
||||||
|
add_sources(KRParticleSystem.cpp)
|
||||||
|
add_sources(KRParticleSystemNewtonian.h)
|
||||||
|
add_sources(KRPointLight.cpp)
|
||||||
|
add_sources(KRRenderSettings.cpp)
|
||||||
|
add_sources(KRResource+blend.cpp)
|
||||||
|
# add_sources(KRResource+fbx.cpp) # TODO - Locate FBX SDK dependencies
|
||||||
|
add_sources(KRResource+obj.cpp)
|
||||||
|
add_sources(KRResource.cpp)
|
||||||
|
add_sources(KRReverbZone.cpp)
|
||||||
|
add_sources(KRScene.cpp)
|
||||||
|
add_sources(KRShader.cpp)
|
||||||
|
add_sources(KRShaderManager.cpp)
|
||||||
|
add_sources(KRSpotLight.cpp)
|
||||||
|
add_sources(KRSprite.cpp)
|
||||||
|
add_sources(KRTexture.cpp)
|
||||||
|
add_sources(KRTexture2D.cpp)
|
||||||
|
add_sources(KRTextureAnimated.cpp)
|
||||||
|
add_sources(KRTextureCube.cpp)
|
||||||
|
add_sources(KRTextureKTX.cpp)
|
||||||
|
add_sources(KRTextureManager.cpp)
|
||||||
|
add_sources(KRTexturePVR.cpp)
|
||||||
|
add_sources(KRTextureTGA.cpp)
|
||||||
|
add_sources(KRUnknown.cpp)
|
||||||
|
add_sources(KRUnknownManager.cpp)
|
||||||
|
add_sources(KRViewport.cpp)
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// #include "KRTextureManager.h"
|
// #include "KRTextureManager.h"
|
||||||
#include "Matrix4.h"
|
|
||||||
#include "Vector3.h"
|
|
||||||
#include "KRMesh.h"
|
#include "KRMesh.h"
|
||||||
#include "KRScene.h"
|
#include "KRScene.h"
|
||||||
#include "KRContext.h"
|
#include "KRContext.h"
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include "KREngine-common.h"
|
#include "KREngine-common.h"
|
||||||
|
|
||||||
#include "KREngine.h"
|
#include "KREngine.h"
|
||||||
#include "KRVector3.h"
|
|
||||||
#include "KRScene.h"
|
#include "KRScene.h"
|
||||||
#include "KRSceneManager.h"
|
#include "KRSceneManager.h"
|
||||||
#include "KRNode.h"
|
#include "KRNode.h"
|
||||||
@@ -256,6 +255,7 @@ void kraken::set_debug_text(const std::string &print_text)
|
|||||||
if(_context) {
|
if(_context) {
|
||||||
delete _context; _context = NULL;
|
delete _context; _context = NULL;
|
||||||
}
|
}
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(int)getParameterCount
|
-(int)getParameterCount
|
||||||
@@ -732,7 +732,7 @@ void kraken::set_debug_text(const std::string &print_text)
|
|||||||
-(void) setSunTemperature:(float)t
|
-(void) setSunTemperature:(float)t
|
||||||
{
|
{
|
||||||
float i = [self getSunIntensity];
|
float i = [self getSunIntensity];
|
||||||
_settings.light_intensity = KRVector3(
|
_settings.light_intensity = Vector3(
|
||||||
(t < 0.5f ? t * 2.0f : 1.0f) * i,
|
(t < 0.5f ? t * 2.0f : 1.0f) * i,
|
||||||
(t < 0.5f ? t * 2.0f : (1.0f - t) * 2.0f) * i,
|
(t < 0.5f ? t * 2.0f : (1.0f - t) * 2.0f) * i,
|
||||||
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i
|
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i
|
||||||
@@ -742,7 +742,7 @@ void kraken::set_debug_text(const std::string &print_text)
|
|||||||
-(void) setSunIntensity:(float)i
|
-(void) setSunIntensity:(float)i
|
||||||
{
|
{
|
||||||
float t = [self getSunTemperature];
|
float t = [self getSunTemperature];
|
||||||
_settings.light_intensity = KRVector3(
|
_settings.light_intensity = Vector3(
|
||||||
(t < 0.5f ? t * 2.0f : 1.0f) * i,
|
(t < 0.5f ? t * 2.0f : 1.0f) * i,
|
||||||
(t < 0.5f ? t * 2.0f : (1.0f - t) * 2.0f) * i,
|
(t < 0.5f ? t * 2.0f : (1.0f - t) * 2.0f) * i,
|
||||||
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i
|
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i
|
||||||
@@ -778,7 +778,7 @@ void kraken::set_debug_text(const std::string &print_text)
|
|||||||
-(void) setAmbientTemperature:(float)t
|
-(void) setAmbientTemperature:(float)t
|
||||||
{
|
{
|
||||||
float i = [self getAmbientIntensity];
|
float i = [self getAmbientIntensity];
|
||||||
_settings.ambient_intensity = KRVector3(
|
_settings.ambient_intensity = Vector3(
|
||||||
(t < 0.5f ? t * 2.0f : 1.0f) * i,
|
(t < 0.5f ? t * 2.0f : 1.0f) * i,
|
||||||
(t < 0.5f ? t * 2.0f : (1.0f - t) * 2.0f) * i,
|
(t < 0.5f ? t * 2.0f : (1.0f - t) * 2.0f) * i,
|
||||||
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i
|
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i
|
||||||
@@ -788,7 +788,7 @@ void kraken::set_debug_text(const std::string &print_text)
|
|||||||
-(void) setAmbientIntensity:(float)i
|
-(void) setAmbientIntensity:(float)i
|
||||||
{
|
{
|
||||||
float t = [self getAmbientTemperature];
|
float t = [self getAmbientTemperature];
|
||||||
_settings.ambient_intensity = KRVector3(
|
_settings.ambient_intensity = Vector3(
|
||||||
(t < 0.5f ? t * 2.0f : 1.0f) * i,
|
(t < 0.5f ? t * 2.0f : 1.0f) * i,
|
||||||
(t < 0.5f ? t * 2.0f : (1.0f - t) * 2.0f) * i,
|
(t < 0.5f ? t * 2.0f : (1.0f - t) * 2.0f) * i,
|
||||||
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i
|
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i
|
||||||
|
|||||||
@@ -37,12 +37,7 @@
|
|||||||
#include "KRShader.h"
|
#include "KRShader.h"
|
||||||
#include "KRShaderManager.h"
|
#include "KRShaderManager.h"
|
||||||
#include "KRContext.h"
|
#include "KRContext.h"
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
|
||||||
#include "../3rdparty/forsyth/forsyth.h"
|
#include "../3rdparty/forsyth/forsyth.h"
|
||||||
#else
|
|
||||||
#include "forsyth.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
KRMesh::KRMesh(KRContext &context, std::string name) : KRResource(context, name) {
|
KRMesh::KRMesh(KRContext &context, std::string name) : KRResource(context, name) {
|
||||||
setName(name);
|
setName(name);
|
||||||
@@ -52,7 +47,6 @@ KRMesh::KRMesh(KRContext &context, std::string name) : KRResource(context, name)
|
|||||||
m_pMetaData = NULL;
|
m_pMetaData = NULL;
|
||||||
m_pIndexBaseData = NULL;
|
m_pIndexBaseData = NULL;
|
||||||
m_constant = false;
|
m_constant = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KRMesh::KRMesh(KRContext &context, std::string name, KRDataBlock *data) : KRResource(context, name) {
|
KRMesh::KRMesh(KRContext &context, std::string name, KRDataBlock *data) : KRResource(context, name) {
|
||||||
|
|||||||
60
kraken/KRMeshStreamer.h
Normal file
60
kraken/KRMeshStreamer.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
//
|
||||||
|
// KRMeshManager.h
|
||||||
|
// 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
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef KRMESHSTREAMER_H
|
||||||
|
#define KRMESHSTREAMER_H
|
||||||
|
|
||||||
|
#include "KREngine-common.h"
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
class KRContext;
|
||||||
|
|
||||||
|
class KRMeshStreamer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KRMeshStreamer(KRContext &context);
|
||||||
|
~KRMeshStreamer();
|
||||||
|
|
||||||
|
void startStreamer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
KRContext &m_context;
|
||||||
|
|
||||||
|
std::thread m_thread;
|
||||||
|
std::atomic<bool> m_stop;
|
||||||
|
std::atomic<bool> m_running;
|
||||||
|
|
||||||
|
void run();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* defined(KRMESHSTREAMER_H) */
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "KRContext.h"
|
#include "KRContext.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
|
|
||||||
|
|||||||
@@ -850,6 +850,10 @@ void KRNode::SetAttribute(node_attribute_type attrib, float v)
|
|||||||
case KRENGINE_NODE_SCALE_OFFSET_Z:
|
case KRENGINE_NODE_SCALE_OFFSET_Z:
|
||||||
setScalingOffset(Vector3(m_scalingOffset.x, m_scalingOffset.y, v));
|
setScalingOffset(Vector3(m_scalingOffset.x, m_scalingOffset.y, v));
|
||||||
break;
|
break;
|
||||||
|
case KRENGINE_NODE_ATTRIBUTE_NONE:
|
||||||
|
case KRENGINE_NODE_ATTRIBUTE_COUNT:
|
||||||
|
// Suppress warnings
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "public/kraken.h"
|
||||||
#include "KROctree.h"
|
#include "KROctree.h"
|
||||||
#include "KRNode.h"
|
#include "KRNode.h"
|
||||||
#include "HitInfo.h"
|
|
||||||
#include "KRCollider.h"
|
#include "KRCollider.h"
|
||||||
|
|
||||||
KROctree::KROctree()
|
KROctree::KROctree()
|
||||||
|
|||||||
@@ -246,7 +246,8 @@ std::vector<KRResource *> KRResource::LoadObj(KRContext &context, const std::str
|
|||||||
while(*pFace != 0 && iVertex < cVertexData) {
|
while(*pFace != 0 && iVertex < cVertexData) {
|
||||||
pMaterial->start_vertex = iVertex;
|
pMaterial->start_vertex = iVertex;
|
||||||
|
|
||||||
int *pMaterialEndFace = pFace + *pFace++;
|
int *pMaterialEndFace = pFace + *pFace;
|
||||||
|
++pFace;
|
||||||
while(pFace < pMaterialEndFace && iVertex < cVertexData) {
|
while(pFace < pMaterialEndFace && iVertex < cVertexData) {
|
||||||
int cFaceVertexes = *pFace;
|
int cFaceVertexes = *pFace;
|
||||||
Vector3 firstFaceVertex;
|
Vector3 firstFaceVertex;
|
||||||
|
|||||||
60
kraken/KRTextureStreamer.h
Normal file
60
kraken/KRTextureStreamer.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
//
|
||||||
|
// KRTextureManager.h
|
||||||
|
// 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
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef KRTEXTURESTREAMER_H
|
||||||
|
#define KRTEXTURESTREAMER_H
|
||||||
|
|
||||||
|
#include "KREngine-common.h"
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
class KRContext;
|
||||||
|
|
||||||
|
class KRTextureStreamer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KRTextureStreamer(KRContext &context);
|
||||||
|
~KRTextureStreamer();
|
||||||
|
|
||||||
|
void startStreamer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
KRContext &m_context;
|
||||||
|
|
||||||
|
std::thread m_thread;
|
||||||
|
std::atomic<bool> m_stop;
|
||||||
|
std::atomic<bool> m_running;
|
||||||
|
|
||||||
|
void run();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* defined(KRTEXTURESTREAMER_H) */
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "KRContext.h"
|
#include "KRContext.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
|
|||||||
Reference in New Issue
Block a user