2012-03-23 02:28:46 +00:00
|
|
|
//
|
|
|
|
|
// KRResource.h
|
|
|
|
|
// KREngine
|
|
|
|
|
//
|
|
|
|
|
// Created by Kearwood Gilbert on 12-03-22.
|
|
|
|
|
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
2013-01-11 03:21:19 +00:00
|
|
|
#include "KREngine-common.h"
|
|
|
|
|
#include "KRContextObject.h"
|
|
|
|
|
#include "KRDataBlock.h"
|
2012-03-23 02:28:46 +00:00
|
|
|
|
2013-01-09 22:37:23 +00:00
|
|
|
#ifndef KRRESOURCE_H
|
|
|
|
|
#define KRRESOURCE_H
|
2012-03-23 02:28:46 +00:00
|
|
|
|
2012-08-17 01:04:49 +00:00
|
|
|
class KRResource : public KRContextObject
|
2012-03-23 02:28:46 +00:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
std::string getName();
|
2012-03-28 21:58:55 +00:00
|
|
|
virtual std::string getExtension() = 0;
|
2012-12-20 01:23:57 +00:00
|
|
|
virtual bool save(const std::string& path);
|
|
|
|
|
virtual bool save(KRDataBlock &data) = 0;
|
2012-03-23 02:28:46 +00:00
|
|
|
|
|
|
|
|
static std::string GetFileExtension(const std::string& name);
|
|
|
|
|
static std::string GetFileBase(const std::string& name);
|
|
|
|
|
static std::string GetFilePath(const std::string& name);
|
|
|
|
|
|
2012-08-17 01:04:49 +00:00
|
|
|
static std::vector<KRResource *> Load(KRContext &context, const std::string& path);
|
2012-03-23 02:28:46 +00:00
|
|
|
|
|
|
|
|
virtual ~KRResource();
|
2012-04-12 00:43:53 +00:00
|
|
|
|
2012-03-23 02:28:46 +00:00
|
|
|
protected:
|
2012-08-17 01:04:49 +00:00
|
|
|
KRResource(KRContext &context, std::string name);
|
2012-03-23 02:28:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::string m_name;
|
|
|
|
|
|
2012-08-17 01:04:49 +00:00
|
|
|
static std::vector<KRResource *> LoadObj(KRContext &context, const std::string& path);
|
2012-10-26 22:10:28 +00:00
|
|
|
#if TARGET_OS_MAC
|
2012-08-17 01:04:49 +00:00
|
|
|
static std::vector<KRResource *> LoadFbx(KRContext &context, const std::string& path);
|
|
|
|
|
static std::vector<KRResource *> LoadBlenderScene(KRContext &context, const std::string& path);
|
2012-10-26 22:10:28 +00:00
|
|
|
#endif
|
2012-03-23 02:28:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|