WIP Correcting library build dependencies
This commit is contained in:
@@ -59,7 +59,21 @@ ENDIF (APPLE)
|
||||
|
||||
add_subdirectory(kraken)
|
||||
|
||||
add_library(kraken STATIC ${SRCS} ${KRAKEN_PUBLIC_HEADERS})
|
||||
add_public_header(hydra/include/aabb.h)
|
||||
add_public_header(hydra/include/hitinfo.h)
|
||||
add_public_header(hydra/include/hydra.h)
|
||||
add_public_header(hydra/include/matrix2.h)
|
||||
add_public_header(hydra/include/matrix2x3.h)
|
||||
add_public_header(hydra/include/matrix4.h)
|
||||
add_public_header(hydra/include/quaternion.h)
|
||||
add_public_header(hydra/include/scalar.h)
|
||||
add_public_header(hydra/include/triangle3.h)
|
||||
add_public_header(hydra/include/vector2.h)
|
||||
add_public_header(hydra/include/vector3.h)
|
||||
add_public_header(hydra/include/vector4.h)
|
||||
add_public_header(hydra/include/vector2i.h)
|
||||
|
||||
add_library(kraken SHARED ${SRCS} ${KRAKEN_PUBLIC_HEADERS})
|
||||
|
||||
set(Boost_USE_STATIC_LIBS ON) # only find static libs
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
@@ -75,13 +89,14 @@ add_subdirectory(hydra)
|
||||
include_directories(hydra/include)
|
||||
target_link_libraries(kraken hydra)
|
||||
|
||||
|
||||
# ---- OpenGL ----
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories( ${OPENGL_INCLUDE_DIRS} )
|
||||
target_link_libraries(kraken ${OPENGL_LIBRARIES})
|
||||
|
||||
# ---- GLAD ----
|
||||
set(GLAD_EXTENSIONS "GL_EXT_texture_filter_anisotropic, GL_EXT_texture_compression_s3tc, GL_S3_s3tc")
|
||||
set(GLAD_EXTENSIONS "GL_EXT_texture_filter_anisotropic,GL_EXT_texture_compression_s3tc, GL_S3_s3tc" CACHE STRING "Gl exts" FORCE)
|
||||
add_subdirectory(3rdparty/glad)
|
||||
include_directories(${GLAD_INCLUDE_DIRS})
|
||||
target_link_libraries(kraken glad)
|
||||
@@ -105,10 +120,21 @@ PROPERTIES
|
||||
PUBLIC_HEADER "${KRAKEN_PUBLIC_HEADERS}"
|
||||
PRIVATE_HEADER "${PRIVATE_HEADER_FILES}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "archive"
|
||||
LIBRARY_OUTPUT_DIRECTORY "lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "lib${LIB_SUFFIX}"
|
||||
OUTPUT_NAME kraken
|
||||
)
|
||||
|
||||
# install(TARGETS kraken DESTINATION ${PROJECT_BINARY_DIR}/lib${LIB_SUFFIX})
|
||||
# install(FILES ${KRAKEN_PUBLIC_HEADERS} DESTINATION ${PROJECT_BINARY_DIR}/include)
|
||||
|
||||
# INSTALL(TARGETS kraken
|
||||
# LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
||||
# ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
||||
# PUBLIC_HEADER DESTINATION "include"
|
||||
# )
|
||||
|
||||
|
||||
|
||||
# add_custom_target(package
|
||||
# COMMENT "Compressing..."
|
||||
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/archive"
|
||||
|
||||
2
hydra
2
hydra
Submodule hydra updated: 759b7af066...5cca3a9fb1
@@ -21,9 +21,10 @@ add_sources(KRBundleManager.cpp)
|
||||
add_sources(KRCamera.cpp)
|
||||
add_sources(KRCollider.cpp)
|
||||
add_sources(KRContext.cpp)
|
||||
add_sources(KRStreamer.cpp)
|
||||
IF(APPLE)
|
||||
add_sources(KREngine.mm)
|
||||
add_sources(KRStreamer.mm)
|
||||
|
||||
IF(IOS)
|
||||
add_sources(KRContext_ios.mm)
|
||||
ELSE()
|
||||
@@ -55,7 +56,7 @@ add_sources(KRNode.cpp)
|
||||
add_sources(KROctree.cpp)
|
||||
add_sources(KROctreeNode.cpp)
|
||||
add_sources(KRParticleSystem.cpp)
|
||||
add_sources(KRParticleSystemNewtonian.h)
|
||||
add_sources(KRParticleSystemNewtonian.cpp)
|
||||
add_sources(KRPointLight.cpp)
|
||||
add_sources(KRRenderSettings.cpp)
|
||||
add_sources(KRResource+blend.cpp)
|
||||
@@ -64,6 +65,7 @@ add_sources(KRResource+obj.cpp)
|
||||
add_sources(KRResource.cpp)
|
||||
add_sources(KRReverbZone.cpp)
|
||||
add_sources(KRScene.cpp)
|
||||
add_sources(KRSceneManager.cpp)
|
||||
add_sources(KRShader.cpp)
|
||||
add_sources(KRShaderManager.cpp)
|
||||
add_sources(KRSpotLight.cpp)
|
||||
@@ -79,3 +81,5 @@ add_sources(KRTextureTGA.cpp)
|
||||
add_sources(KRUnknown.cpp)
|
||||
add_sources(KRUnknownManager.cpp)
|
||||
add_sources(KRViewport.cpp)
|
||||
add_sources(../3rdparty/tinyxml2/tinyxml2.cpp)
|
||||
add_sources(../3rdparty/forsyth/forsyth.cpp)
|
||||
|
||||
@@ -1,89 +1,89 @@
|
||||
//
|
||||
// KRParticleSystemNewtonian.cpp
|
||||
// KREngine
|
||||
//
|
||||
// Created by Kearwood Gilbert on 2012-11-02.
|
||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#include "KREngine-common.h"
|
||||
#include "KRParticleSystemNewtonian.h"
|
||||
#include "KRTexture.h"
|
||||
#include "KRContext.h"
|
||||
|
||||
KRParticleSystemNewtonian::KRParticleSystemNewtonian(KRScene &scene, std::string name) : KRParticleSystem(scene, name)
|
||||
{
|
||||
m_particlesAbsoluteTime = 0.0f;
|
||||
}
|
||||
|
||||
KRParticleSystemNewtonian::~KRParticleSystemNewtonian()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string KRParticleSystemNewtonian::getElementName()
|
||||
{
|
||||
return "newtonian_particles";
|
||||
}
|
||||
|
||||
void KRParticleSystemNewtonian::loadXML(tinyxml2::XMLElement *e)
|
||||
{
|
||||
KRParticleSystem::loadXML(e);
|
||||
}
|
||||
|
||||
tinyxml2::XMLElement *KRParticleSystemNewtonian::saveXML( tinyxml2::XMLNode *parent)
|
||||
{
|
||||
tinyxml2::XMLElement *e = KRParticleSystem::saveXML(parent);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
AABB KRParticleSystemNewtonian::getBounds()
|
||||
{
|
||||
return AABB(-Vector3::One(), Vector3::One(), getModelMatrix());
|
||||
}
|
||||
|
||||
void KRParticleSystemNewtonian::physicsUpdate(float deltaTime)
|
||||
{
|
||||
KRParticleSystem::physicsUpdate(deltaTime);
|
||||
m_particlesAbsoluteTime += deltaTime;
|
||||
}
|
||||
|
||||
bool KRParticleSystemNewtonian::hasPhysics()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void KRParticleSystemNewtonian::render(KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass) {
|
||||
|
||||
if(m_lod_visible <= LOD_VISIBILITY_PRESTREAM) return;
|
||||
|
||||
KRNode::render(pCamera, point_lights, directional_lights, spot_lights, viewport, renderPass);
|
||||
|
||||
if(renderPass == KRNode::RENDER_PASS_ADDITIVE_PARTICLES) {
|
||||
if(viewport.visible(getBounds())) {
|
||||
|
||||
|
||||
// Enable z-buffer test
|
||||
GLDEBUG(glEnable(GL_DEPTH_TEST));
|
||||
GLDEBUG(glDepthRangef(0.0, 1.0));
|
||||
|
||||
KRTexture *pParticleTexture = m_pContext->getTextureManager()->getTexture("flare");
|
||||
m_pContext->getTextureManager()->selectTexture(0, pParticleTexture, 0.0f, KRTexture::TEXTURE_USAGE_PARTICLE);
|
||||
|
||||
int particle_count = 10000;
|
||||
|
||||
KRShader *pParticleShader = m_pContext->getShaderManager()->getShader("dust_particle", pCamera, point_lights, directional_lights, spot_lights, 0, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, renderPass);
|
||||
|
||||
Vector3 rim_color; Vector4 fade_color;
|
||||
if(getContext().getShaderManager()->selectShader(*pCamera, pParticleShader, viewport, getModelMatrix(), point_lights, directional_lights, spot_lights, 0, renderPass, Vector3::Zero(), 0.0f, Vector4::Zero())) {
|
||||
pParticleShader->setUniform(KRShader::KRENGINE_UNIFORM_FLARE_SIZE, 1.0f);
|
||||
|
||||
KRDataBlock index_data;
|
||||
m_pContext->getMeshManager()->bindVBO(m_pContext->getMeshManager()->getRandomParticles(), index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX) | (1 << KRMesh::KRENGINE_ATTRIB_TEXUVA), false, 1.0f);
|
||||
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, particle_count*3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// KRParticleSystemNewtonian.cpp
|
||||
// KREngine
|
||||
//
|
||||
// Created by Kearwood Gilbert on 2012-11-02.
|
||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#include "KREngine-common.h"
|
||||
#include "KRParticleSystemNewtonian.h"
|
||||
#include "KRTexture.h"
|
||||
#include "KRContext.h"
|
||||
|
||||
KRParticleSystemNewtonian::KRParticleSystemNewtonian(KRScene &scene, std::string name) : KRParticleSystem(scene, name)
|
||||
{
|
||||
m_particlesAbsoluteTime = 0.0f;
|
||||
}
|
||||
|
||||
KRParticleSystemNewtonian::~KRParticleSystemNewtonian()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string KRParticleSystemNewtonian::getElementName()
|
||||
{
|
||||
return "newtonian_particles";
|
||||
}
|
||||
|
||||
void KRParticleSystemNewtonian::loadXML(tinyxml2::XMLElement *e)
|
||||
{
|
||||
KRParticleSystem::loadXML(e);
|
||||
}
|
||||
|
||||
tinyxml2::XMLElement *KRParticleSystemNewtonian::saveXML( tinyxml2::XMLNode *parent)
|
||||
{
|
||||
tinyxml2::XMLElement *e = KRParticleSystem::saveXML(parent);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
AABB KRParticleSystemNewtonian::getBounds()
|
||||
{
|
||||
return AABB::Create(-Vector3::One(), Vector3::One(), getModelMatrix());
|
||||
}
|
||||
|
||||
void KRParticleSystemNewtonian::physicsUpdate(float deltaTime)
|
||||
{
|
||||
KRParticleSystem::physicsUpdate(deltaTime);
|
||||
m_particlesAbsoluteTime += deltaTime;
|
||||
}
|
||||
|
||||
bool KRParticleSystemNewtonian::hasPhysics()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void KRParticleSystemNewtonian::render(KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass) {
|
||||
|
||||
if(m_lod_visible <= LOD_VISIBILITY_PRESTREAM) return;
|
||||
|
||||
KRNode::render(pCamera, point_lights, directional_lights, spot_lights, viewport, renderPass);
|
||||
|
||||
if(renderPass == KRNode::RENDER_PASS_ADDITIVE_PARTICLES) {
|
||||
if(viewport.visible(getBounds())) {
|
||||
|
||||
|
||||
// Enable z-buffer test
|
||||
GLDEBUG(glEnable(GL_DEPTH_TEST));
|
||||
GLDEBUG(glDepthRangef(0.0, 1.0));
|
||||
|
||||
KRTexture *pParticleTexture = m_pContext->getTextureManager()->getTexture("flare");
|
||||
m_pContext->getTextureManager()->selectTexture(0, pParticleTexture, 0.0f, KRTexture::TEXTURE_USAGE_PARTICLE);
|
||||
|
||||
int particle_count = 10000;
|
||||
|
||||
KRShader *pParticleShader = m_pContext->getShaderManager()->getShader("dust_particle", pCamera, point_lights, directional_lights, spot_lights, 0, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, renderPass);
|
||||
|
||||
Vector3 rim_color; Vector4 fade_color;
|
||||
if(getContext().getShaderManager()->selectShader(*pCamera, pParticleShader, viewport, getModelMatrix(), point_lights, directional_lights, spot_lights, 0, renderPass, Vector3::Zero(), 0.0f, Vector4::Zero())) {
|
||||
pParticleShader->setUniform(KRShader::KRENGINE_UNIFORM_FLARE_SIZE, 1.0f);
|
||||
|
||||
KRDataBlock index_data;
|
||||
m_pContext->getMeshManager()->bindVBO(m_pContext->getMeshManager()->getRandomParticles(), index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX) | (1 << KRMesh::KRENGINE_ATTRIB_TEXUVA), false, 1.0f);
|
||||
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, particle_count*3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
115
kraken/KRStreamer.mm → kraken/KRStreamer.cpp
Executable file → Normal file
115
kraken/KRStreamer.mm → kraken/KRStreamer.cpp
Executable file → Normal file
@@ -1,55 +1,60 @@
|
||||
//
|
||||
// KRStreamer.cpp
|
||||
// Kraken
|
||||
//
|
||||
// Created by Kearwood Gilbert on 11/1/2013.
|
||||
// Copyright (c) 2013 Kearwood Software. All rights reserved.
|
||||
//
|
||||
|
||||
#include "KREngine-common.h"
|
||||
|
||||
#include "KRStreamer.h"
|
||||
#include "KRContext.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
|
||||
KRStreamer::KRStreamer(KRContext &context) : m_context(context)
|
||||
{
|
||||
m_running = false;
|
||||
m_stop = false;
|
||||
}
|
||||
|
||||
void KRStreamer::startStreamer()
|
||||
{
|
||||
if(!m_running) {
|
||||
m_running = true;
|
||||
KRContext::activateStreamerContext();
|
||||
|
||||
m_thread = std::thread(&KRStreamer::run, this);
|
||||
}
|
||||
}
|
||||
|
||||
KRStreamer::~KRStreamer()
|
||||
{
|
||||
if(m_running) {
|
||||
m_stop = true;
|
||||
m_thread.join();
|
||||
m_running = false;
|
||||
}
|
||||
}
|
||||
|
||||
void KRStreamer::run()
|
||||
{
|
||||
pthread_setname_np("Kraken - Streamer");
|
||||
|
||||
std::chrono::microseconds sleep_duration( 15000 );
|
||||
|
||||
KRContext::activateStreamerContext();
|
||||
|
||||
while(!m_stop)
|
||||
{
|
||||
m_context.doStreaming();
|
||||
std::this_thread::sleep_for( sleep_duration );
|
||||
}
|
||||
}
|
||||
//
|
||||
// KRStreamer.cpp
|
||||
// Kraken
|
||||
//
|
||||
// Created by Kearwood Gilbert on 11/1/2013.
|
||||
// Copyright (c) 2013 Kearwood Software. All rights reserved.
|
||||
//
|
||||
|
||||
#include "KREngine-common.h"
|
||||
|
||||
#include "KRStreamer.h"
|
||||
#include "KRContext.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
|
||||
KRStreamer::KRStreamer(KRContext &context) : m_context(context)
|
||||
{
|
||||
m_running = false;
|
||||
m_stop = false;
|
||||
}
|
||||
|
||||
void KRStreamer::startStreamer()
|
||||
{
|
||||
if(!m_running) {
|
||||
m_running = true;
|
||||
KRContext::activateStreamerContext();
|
||||
|
||||
m_thread = std::thread(&KRStreamer::run, this);
|
||||
}
|
||||
}
|
||||
|
||||
KRStreamer::~KRStreamer()
|
||||
{
|
||||
if(m_running) {
|
||||
m_stop = true;
|
||||
m_thread.join();
|
||||
m_running = false;
|
||||
}
|
||||
}
|
||||
|
||||
void KRStreamer::run()
|
||||
{
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
// TODO - Set thread names on windows
|
||||
#else
|
||||
pthread_setname_np("Kraken - Streamer");
|
||||
#endif
|
||||
|
||||
std::chrono::microseconds sleep_duration( 15000 );
|
||||
|
||||
KRContext::activateStreamerContext();
|
||||
|
||||
while(!m_stop)
|
||||
{
|
||||
m_context.doStreaming();
|
||||
std::this_thread::sleep_for( sleep_duration );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user