Removed KRMeshStreamer and KRTextureStreamer dead code (replaced by KRStreamer)
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 <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) */
|
||||
@@ -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 <chrono>
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#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 );
|
||||
}
|
||||
}
|
||||
@@ -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 <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) */
|
||||
@@ -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 <chrono>
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
|
||||
#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 );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user