mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-30 22:07:58 +03:00
Imported Upstream version 0.26.0
This commit is contained in:
commit
9a2b6c69b6
1398 changed files with 212217 additions and 0 deletions
89
extern/shiny/Main/Platform.cpp
vendored
Normal file
89
extern/shiny/Main/Platform.cpp
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
#include "Platform.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "Factory.hpp"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
Platform::Platform (const std::string& basePath)
|
||||
: mBasePath(basePath)
|
||||
, mCacheFolder("./")
|
||||
, mFactory(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
Platform::~Platform ()
|
||||
{
|
||||
}
|
||||
|
||||
void Platform::setFactory (Factory* factory)
|
||||
{
|
||||
mFactory = factory;
|
||||
}
|
||||
|
||||
std::string Platform::getBasePath ()
|
||||
{
|
||||
return mBasePath;
|
||||
}
|
||||
|
||||
bool Platform::supportsMaterialQueuedListener ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Platform::supportsShaderSerialization ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MaterialInstance* Platform::fireMaterialRequested (const std::string& name, const std::string& configuration, unsigned short lodIndex)
|
||||
{
|
||||
return mFactory->requestMaterial (name, configuration, lodIndex);
|
||||
}
|
||||
|
||||
void Platform::serializeShaders (const std::string& file)
|
||||
{
|
||||
throw std::runtime_error ("Shader serialization not supported by this platform");
|
||||
}
|
||||
|
||||
void Platform::deserializeShaders (const std::string& file)
|
||||
{
|
||||
throw std::runtime_error ("Shader serialization not supported by this platform");
|
||||
}
|
||||
|
||||
void Platform::setCacheFolder (const std::string& folder)
|
||||
{
|
||||
mCacheFolder = folder;
|
||||
}
|
||||
|
||||
std::string Platform::getCacheFolder() const
|
||||
{
|
||||
return mCacheFolder;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
bool TextureUnitState::setPropertyOverride (const std::string& name, PropertyValuePtr& value, PropertySetGet *context)
|
||||
{
|
||||
if (name == "texture_alias")
|
||||
{
|
||||
std::string aliasName = retrieveValue<StringValue>(value, context).get();
|
||||
|
||||
Factory::getInstance().addTextureAliasInstance (aliasName, this);
|
||||
|
||||
setTextureName (Factory::getInstance().retrieveTextureAlias (aliasName));
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
TextureUnitState::~TextureUnitState()
|
||||
{
|
||||
Factory* f = Factory::getInstancePtr ();
|
||||
if (f)
|
||||
f->removeTextureAliasInstances (this);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue