2012-04-12 19:43:08 +00:00
|
|
|
//
|
|
|
|
|
// KRContext.h
|
|
|
|
|
// KREngine
|
|
|
|
|
//
|
|
|
|
|
// Created by Kearwood Gilbert on 12-04-12.
|
|
|
|
|
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef KREngine_KRContext_h
|
|
|
|
|
#define KREngine_KRContext_h
|
|
|
|
|
|
2013-01-11 03:21:19 +00:00
|
|
|
#include "KREngine-common.h"
|
|
|
|
|
#include "KRBundleManager.h"
|
|
|
|
|
#include "KRSceneManager.h"
|
|
|
|
|
#include "KRTextureManager.h"
|
|
|
|
|
#include "KRMaterialManager.h"
|
|
|
|
|
#include "KRShaderManager.h"
|
|
|
|
|
#include "KRMeshManager.h"
|
|
|
|
|
#include "KRAnimationManager.h"
|
|
|
|
|
#include "KRAnimationCurveManager.h"
|
|
|
|
|
#include "KRAudioManager.h"
|
|
|
|
|
#include "KRUnknownManager.h"
|
2012-10-19 23:17:43 +00:00
|
|
|
|
2012-04-12 19:43:08 +00:00
|
|
|
class KRContext {
|
|
|
|
|
public:
|
2012-10-19 23:17:43 +00:00
|
|
|
static int KRENGINE_MAX_VBO_HANDLES;
|
|
|
|
|
static int KRENGINE_MAX_VBO_MEM;
|
|
|
|
|
static int KRENGINE_MAX_SHADER_HANDLES;
|
|
|
|
|
static int KRENGINE_MAX_TEXTURE_HANDLES;
|
|
|
|
|
static int KRENGINE_MAX_TEXTURE_MEM;
|
|
|
|
|
static int KRENGINE_TARGET_TEXTURE_MEM_MAX;
|
|
|
|
|
static int KRENGINE_TARGET_TEXTURE_MEM_MIN;
|
|
|
|
|
static int KRENGINE_MAX_TEXTURE_DIM;
|
|
|
|
|
static int KRENGINE_MIN_TEXTURE_DIM;
|
2012-11-17 00:15:52 +00:00
|
|
|
static int KRENGINE_MAX_TEXTURE_THROUGHPUT;
|
2012-10-19 23:17:43 +00:00
|
|
|
|
|
|
|
|
|
2012-04-13 23:24:07 +00:00
|
|
|
KRContext();
|
2012-04-12 19:43:08 +00:00
|
|
|
~KRContext();
|
|
|
|
|
|
2012-09-11 03:06:35 +00:00
|
|
|
void loadResource(const std::string &file_name, KRDataBlock *data);
|
2012-04-12 19:43:08 +00:00
|
|
|
void loadResource(std::string path);
|
|
|
|
|
|
2012-09-11 03:06:35 +00:00
|
|
|
KRBundleManager *getBundleManager();
|
2012-04-12 19:43:08 +00:00
|
|
|
KRSceneManager *getSceneManager();
|
|
|
|
|
KRTextureManager *getTextureManager();
|
|
|
|
|
KRMaterialManager *getMaterialManager();
|
|
|
|
|
KRShaderManager *getShaderManager();
|
2013-01-09 22:37:23 +00:00
|
|
|
KRMeshManager *getModelManager();
|
2012-12-01 02:03:18 +00:00
|
|
|
KRAnimationManager *getAnimationManager();
|
2012-12-07 00:20:06 +00:00
|
|
|
KRAnimationCurveManager *getAnimationCurveManager();
|
2013-01-05 04:04:58 +00:00
|
|
|
KRAudioManager *getAudioManager();
|
2013-01-02 22:00:29 +00:00
|
|
|
KRUnknownManager *getUnknownManager();
|
2012-04-12 19:43:08 +00:00
|
|
|
|
2012-08-17 01:04:49 +00:00
|
|
|
KRCamera *createCamera(int width, int height);
|
|
|
|
|
|
2012-09-26 20:07:48 +00:00
|
|
|
void rotateBuffers(bool new_frame);
|
2012-09-13 20:09:19 +00:00
|
|
|
|
2012-11-01 22:16:59 +00:00
|
|
|
enum {
|
|
|
|
|
KRENGINE_GL_EXT_texture_storage,
|
|
|
|
|
KRENGINE_NUM_EXTENSIONS
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const char * extension_names[KRENGINE_NUM_EXTENSIONS];
|
|
|
|
|
static bool extension_available[KRENGINE_NUM_EXTENSIONS];
|
|
|
|
|
|
2012-12-07 01:49:17 +00:00
|
|
|
void startFrame(float deltaTime);
|
2012-11-23 01:02:22 +00:00
|
|
|
void endFrame(float deltaTime);
|
2012-11-17 00:15:52 +00:00
|
|
|
|
2012-11-23 01:02:22 +00:00
|
|
|
long getCurrentFrame() const;
|
|
|
|
|
float getAbsoluteTime() const;
|
2013-03-21 19:58:35 -07:00
|
|
|
|
2013-03-22 17:17:12 -07:00
|
|
|
long getAbsoluteTimeMilliseconds();
|
|
|
|
|
|
2013-05-06 12:58:57 -07:00
|
|
|
std::vector<KRResource *> getResources();
|
|
|
|
|
|
2012-04-12 19:43:08 +00:00
|
|
|
private:
|
2012-09-11 03:06:35 +00:00
|
|
|
KRBundleManager *m_pBundleManager;
|
2012-04-12 19:43:08 +00:00
|
|
|
KRSceneManager *m_pSceneManager;
|
|
|
|
|
KRTextureManager *m_pTextureManager;
|
|
|
|
|
KRMaterialManager *m_pMaterialManager;
|
|
|
|
|
KRShaderManager *m_pShaderManager;
|
2013-01-09 22:37:23 +00:00
|
|
|
KRMeshManager *m_pModelManager;
|
2012-12-01 02:03:18 +00:00
|
|
|
KRAnimationManager *m_pAnimationManager;
|
2012-12-07 00:20:06 +00:00
|
|
|
KRAnimationCurveManager *m_pAnimationCurveManager;
|
2013-01-05 04:04:58 +00:00
|
|
|
KRAudioManager *m_pSoundManager;
|
2013-01-02 22:00:29 +00:00
|
|
|
KRUnknownManager *m_pUnknownManager;
|
2012-11-01 22:16:59 +00:00
|
|
|
|
|
|
|
|
void detectExtensions();
|
|
|
|
|
bool m_bDetectedExtensions;
|
2012-11-17 00:15:52 +00:00
|
|
|
|
|
|
|
|
long m_current_frame;
|
2012-11-23 01:02:22 +00:00
|
|
|
float m_absolute_time;
|
2013-03-06 15:46:54 -08:00
|
|
|
|
|
|
|
|
mach_timebase_info_data_t m_timebase_info;
|
2012-04-12 19:43:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|