More CMake conversion, compile fixes

This commit is contained in:
2017-11-05 23:41:22 -08:00
parent ea1c447f1d
commit 9cf91d6332
12 changed files with 191 additions and 18 deletions

View File

@@ -48,10 +48,12 @@ IF(APPLE)
FIND_LIBRARY(APPKIT_LIBRARY AppKit)
FIND_LIBRARY(OPENGL_LIBRARY OpenGL)
FIND_LIBRARY(AUDIO_TOOLBOX_LIBRARY AudioToolbox)
FIND_LIBRARY(ACCELERATE_LIBRARY Accelerate)
MARK_AS_ADVANCED (APPKIT_LIBRARY
OPENGL_LIBRARY
AUDIO_TOOLBOX_LIBRARY)
SET(EXTRA_LIBS ${APPKIT_LIBRARY} ${OPENGL_LIBRARY} ${AUDIO_TOOLBOX_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)
ENDIF (APPLE)

View File

@@ -25,7 +25,6 @@ add_sources(KRAudioManager.cpp)
add_sources(KRAudioSample.cpp)
add_sources(KRAudioSource.cpp)
add_sources(KRBehavior.cpp)
add_sources(KRDataBlock.cpp)
add_sources(KRBone.cpp)
add_sources(KRBundle.cpp)
add_sources(KRBundleManager.cpp)
@@ -33,9 +32,62 @@ add_sources(KRCamera.cpp)
add_sources(KRCollider.cpp)
add_sources(KRContext.cpp)
IF(APPLE)
add_sources(KREngine.mm)
add_sources(KRStreamer.mm)
add_sources(KRMeshStreamer.mm)
add_sources(KRTextureStreamer.mm)
IF(IOS)
add_sources(KRContext_ios.mm)
ELSE()
add_sources(KRContext_osx.mm)
ENDIF()
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)

View File

@@ -30,8 +30,6 @@
//
// #include "KRTextureManager.h"
#include "Matrix4.h"
#include "Vector3.h"
#include "KRMesh.h"
#include "KRScene.h"
#include "KRContext.h"

View File

@@ -32,7 +32,6 @@
#include "KREngine-common.h"
#include "KREngine.h"
#include "KRVector3.h"
#include "KRScene.h"
#include "KRSceneManager.h"
#include "KRNode.h"
@@ -256,6 +255,7 @@ void kraken::set_debug_text(const std::string &print_text)
if(_context) {
delete _context; _context = NULL;
}
[super dealloc];
}
-(int)getParameterCount
@@ -732,7 +732,7 @@ void kraken::set_debug_text(const std::string &print_text)
-(void) setSunTemperature:(float)t
{
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 - 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
{
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 - 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
{
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 - 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
{
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 - t) * 2.0f) * i,
(t < 0.5f ? 1.0f : (1.0f - t) * 2.0f) * i

View File

@@ -37,12 +37,7 @@
#include "KRShader.h"
#include "KRShaderManager.h"
#include "KRContext.h"
#if defined(_WIN32) || defined(_WIN64)
#include "../3rdparty/forsyth/forsyth.h"
#else
#include "forsyth.h"
#endif
KRMesh::KRMesh(KRContext &context, std::string name) : KRResource(context, name) {
setName(name);
@@ -52,7 +47,6 @@ KRMesh::KRMesh(KRContext &context, std::string name) : KRResource(context, name)
m_pMetaData = NULL;
m_pIndexBaseData = NULL;
m_constant = false;
}
KRMesh::KRMesh(KRContext &context, std::string name, KRDataBlock *data) : KRResource(context, name) {

60
kraken/KRMeshStreamer.h Normal file
View 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) */

View File

@@ -12,6 +12,7 @@
#include "KRContext.h"
#include <chrono>
#include <AppKit/AppKit.h>
#if TARGET_OS_IPHONE

View File

@@ -850,6 +850,10 @@ void KRNode::SetAttribute(node_attribute_type attrib, float v)
case KRENGINE_NODE_SCALE_OFFSET_Z:
setScalingOffset(Vector3(m_scalingOffset.x, m_scalingOffset.y, v));
break;
case KRENGINE_NODE_ATTRIBUTE_NONE:
case KRENGINE_NODE_ATTRIBUTE_COUNT:
// Suppress warnings
break;
}
}

View File

@@ -6,9 +6,9 @@
// Copyright (c) 2012 Kearwood Software. All rights reserved.
//
#include "public/kraken.h"
#include "KROctree.h"
#include "KRNode.h"
#include "HitInfo.h"
#include "KRCollider.h"
KROctree::KROctree()

View File

@@ -246,7 +246,8 @@ std::vector<KRResource *> KRResource::LoadObj(KRContext &context, const std::str
while(*pFace != 0 && iVertex < cVertexData) {
pMaterial->start_vertex = iVertex;
int *pMaterialEndFace = pFace + *pFace++;
int *pMaterialEndFace = pFace + *pFace;
++pFace;
while(pFace < pMaterialEndFace && iVertex < cVertexData) {
int cFaceVertexes = *pFace;
Vector3 firstFaceVertex;

View 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) */

View File

@@ -12,6 +12,7 @@
#include "KRContext.h"
#include <chrono>
#include <AppKit/AppKit.h>
#if TARGET_OS_IPHONE