From d0885edfeb149221df50f1ff8d5c6494c75d8810 Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Sun, 5 Nov 2017 23:50:32 -0800 Subject: [PATCH] Removed KRMeshStreamer and KRTextureStreamer dead code (replaced by KRStreamer) --- kraken/CMakeLists.txt | 2 - kraken/KRMeshStreamer.h | 60 ----------------------- kraken/KRMeshStreamer.mm | 92 ---------------------------------- kraken/KRTextureStreamer.h | 60 ----------------------- kraken/KRTextureStreamer.mm | 98 ------------------------------------- 5 files changed, 312 deletions(-) delete mode 100644 kraken/KRMeshStreamer.h delete mode 100755 kraken/KRMeshStreamer.mm delete mode 100644 kraken/KRTextureStreamer.h delete mode 100755 kraken/KRTextureStreamer.mm diff --git a/kraken/CMakeLists.txt b/kraken/CMakeLists.txt index b1c1f38..3658da8 100644 --- a/kraken/CMakeLists.txt +++ b/kraken/CMakeLists.txt @@ -34,8 +34,6 @@ 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() diff --git a/kraken/KRMeshStreamer.h b/kraken/KRMeshStreamer.h deleted file mode 100644 index beb3666..0000000 --- a/kraken/KRMeshStreamer.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// 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 -#include - -class KRContext; - -class KRMeshStreamer -{ -public: - KRMeshStreamer(KRContext &context); - ~KRMeshStreamer(); - - void startStreamer(); - -private: - KRContext &m_context; - - std::thread m_thread; - std::atomic m_stop; - std::atomic m_running; - - void run(); -}; - -#endif /* defined(KRMESHSTREAMER_H) */ diff --git a/kraken/KRMeshStreamer.mm b/kraken/KRMeshStreamer.mm deleted file mode 100755 index 30dd46c..0000000 --- a/kraken/KRMeshStreamer.mm +++ /dev/null @@ -1,92 +0,0 @@ -// -// KRMeshStreamer.cpp -// Kraken -// -// Created by Kearwood Gilbert on 11/1/2013. -// Copyright (c) 2013 Kearwood Software. All rights reserved. -// - -#include "KRMeshStreamer.h" - -#include "KREngine-common.h" -#include "KRContext.h" - -#include -#include - -#if TARGET_OS_IPHONE - -EAGLContext *gMeshStreamerContext = nil; - -#elif TARGET_OS_MAC - -NSOpenGLContext *gMeshStreamerContext = nil; - -#else - -#error Unsupported Platform -#endif - -KRMeshStreamer::KRMeshStreamer(KRContext &context) : m_context(context) -{ - m_running = false; - m_stop = false; -} - -void KRMeshStreamer::startStreamer() -{ - if(!m_running) { - m_running = true; - -#if TARGET_OS_IPHONE - gMeshStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: [EAGLContext currentContext].sharegroup]; -#elif TARGET_OS_MAC - NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = - { -// NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy, - 0 - }; - NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes] autorelease]; - gMeshStreamerContext = [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: [NSOpenGLContext currentContext] ]; -#else - #error Unsupported Platform -#endif - - m_thread = std::thread(&KRMeshStreamer::run, this); - } -} - -KRMeshStreamer::~KRMeshStreamer() -{ - if(m_running) { - m_stop = true; - m_thread.join(); - m_running = false; - } - - [gMeshStreamerContext release]; -} - -void KRMeshStreamer::run() -{ - pthread_setname_np("Kraken - Mesh Streamer"); - - std::chrono::microseconds sleep_duration( 100 ); - -#if TARGET_OS_IPHONE - [EAGLContext setCurrentContext: gMeshStreamerContext]; -#elif TARGET_OS_MAC - [gMeshStreamerContext makeCurrentContext]; -#else - #error Unsupported Platform -#endif - - - while(!m_stop) - { - if(m_context.getStreamingEnabled()) { - - } - std::this_thread::sleep_for( sleep_duration ); - } -} diff --git a/kraken/KRTextureStreamer.h b/kraken/KRTextureStreamer.h deleted file mode 100644 index 39f3705..0000000 --- a/kraken/KRTextureStreamer.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// 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 -#include - -class KRContext; - -class KRTextureStreamer -{ -public: - KRTextureStreamer(KRContext &context); - ~KRTextureStreamer(); - - void startStreamer(); - -private: - KRContext &m_context; - - std::thread m_thread; - std::atomic m_stop; - std::atomic m_running; - - void run(); -}; - -#endif /* defined(KRTEXTURESTREAMER_H) */ diff --git a/kraken/KRTextureStreamer.mm b/kraken/KRTextureStreamer.mm deleted file mode 100755 index 8fd497f..0000000 --- a/kraken/KRTextureStreamer.mm +++ /dev/null @@ -1,98 +0,0 @@ -// -// KRTextureStreamer.cpp -// Kraken -// -// Created by Kearwood Gilbert on 11/1/2013. -// Copyright (c) 2013 Kearwood Software. All rights reserved. -// - -#include "KREngine-common.h" - -#include "KRTextureStreamer.h" -#include "KRContext.h" - -#include -#include - - -#if TARGET_OS_IPHONE - -EAGLContext *gTextureStreamerContext = nil; - -#elif TARGET_OS_MAC - -NSOpenGLContext *gTextureStreamerContext = nil; - -#else - -#error Unsupported Platform -#endif - -KRTextureStreamer::KRTextureStreamer(KRContext &context) : m_context(context) -{ - m_running = false; - m_stop = false; -} - -void KRTextureStreamer::startStreamer() -{ - if(!m_running) { - m_running = true; - -#if TARGET_OS_IPHONE - - gTextureStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: [EAGLContext currentContext].sharegroup]; - - -#elif TARGET_OS_MAC - - NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = - { -// NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy, - 0 - }; - NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes] autorelease]; - gTextureStreamerContext = [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: [NSOpenGLContext currentContext] ]; - -#else - - #error Unsupported Platform -#endif - - m_thread = std::thread(&KRTextureStreamer::run, this); - } -} - -KRTextureStreamer::~KRTextureStreamer() -{ - if(m_running) { - m_stop = true; - m_thread.join(); - m_running = false; - } - - [gTextureStreamerContext release]; -} - -void KRTextureStreamer::run() -{ - pthread_setname_np("Kraken - Texture Streamer"); - - std::chrono::microseconds sleep_duration( 100 ); - -#if TARGET_OS_IPHONE - [EAGLContext setCurrentContext: gTextureStreamerContext]; -#elif TARGET_OS_MAC - [gTextureStreamerContext makeCurrentContext]; -#else -#error Unsupported Platform -#endif - - while(!m_stop) - { - if(m_context.getStreamingEnabled()) { - m_context.getTextureManager()->doStreaming(); - } - std::this_thread::sleep_for( sleep_duration ); - } -}