Sync upstream changes to shiny

deque
scrawl 11 years ago
parent 44b517f66d
commit c5a9cd0aa1

@ -1,6 +1,7 @@
#if SH_HLSL == 1 || SH_CG == 1
#define shTexture2D sampler2D
#define shTexture3D sampler3D
#define shSample(tex, coord) tex2D(tex, coord)
#define shCubicSample(tex, coord) texCUBE(tex, coord)
#define shLerp(a, b, t) lerp(a, b, t)
@ -8,6 +9,8 @@
#define shSampler2D(name) , uniform sampler2D name : register(s@shCounter(0)) @shUseSampler(name)
#define shSampler3D(name) , uniform sampler3D name : register(s@shCounter(0)) @shUseSampler(name)
#define shSamplerCube(name) , uniform samplerCUBE name : register(s@shCounter(0)) @shUseSampler(name)
#define shMatrixMult(m, v) mul(m, v)
@ -67,6 +70,7 @@
#define int3 ivec3
#define int4 ivec4
#define shTexture2D sampler2D
#define shTexture3D sampler3D
#define shSample(tex, coord) texture2D(tex, coord)
#define shCubicSample(tex, coord) textureCube(tex, coord)
#define shLerp(a, b, t) mix(a, b, t)
@ -76,6 +80,8 @@
#define shSampler2D(name) uniform sampler2D name; @shUseSampler(name)
#define shSampler3D(name) uniform sampler3D name; @shUseSampler(name)
#define shSamplerCube(name) uniform samplerCube name; @shUseSampler(name)
#define shMatrixMult(m, v) (m * v)

@ -284,8 +284,9 @@ namespace sh
MaterialInstance* Factory::findInstance (const std::string& name)
{
assert (mMaterials.find(name) != mMaterials.end());
return &mMaterials.find(name)->second;
MaterialInstance* m = searchInstance(name);
assert (m);
return m;
}
MaterialInstance* Factory::requestMaterial (const std::string& name, const std::string& configuration, unsigned short lodIndex)
@ -297,28 +298,25 @@ namespace sh
if (m)
{
// make sure all lod techniques below (higher lod) exist
int i = lodIndex;
while (i>0)
{
--i;
if (m->createForConfiguration (configuration, i))
if (m->createForConfiguration (configuration, 0))
{
if (mListener)
mListener->materialCreated (m, configuration, i);
mListener->materialCreated (m, configuration, 0);
}
else
return NULL;
}
if (m->createForConfiguration (configuration, lodIndex))
for (LodConfigurationMap::iterator it = mLodConfigurations.begin(); it != mLodConfigurations.end(); ++it)
{
if (m->createForConfiguration (configuration, it->first))
{
if (mListener)
mListener->materialCreated (m, configuration, lodIndex);
mListener->materialCreated (m, configuration, it->first);
}
else
return NULL;
}
}
return m;
}
@ -625,7 +623,13 @@ namespace sh
{
MaterialInstance* m = searchInstance (name);
assert(m);
m->createForConfiguration (configuration, 0);
for (LodConfigurationMap::iterator it = mLodConfigurations.begin(); it != mLodConfigurations.end(); ++it)
{
m->createForConfiguration (configuration, it->first);
}
}
bool Factory::removeCache(const std::string& pattern)

@ -259,8 +259,8 @@ namespace sh
Platform* mPlatform;
MaterialInstance* findInstance (const std::string& name);
private:
MaterialInstance* searchInstance (const std::string& name);
/// @return was anything removed?
bool removeCache (const std::string& pattern);

@ -163,7 +163,8 @@ namespace sh
mTexUnits.push_back(texUnit);
// set texture unit indices (required by GLSL)
if (useShaders && ((hasVertex && foundVertex) || (hasFragment && foundFragment)) && (mFactory->getCurrentLanguage () == Language_GLSL || mFactory->getCurrentLanguage() == Language_GLSLES))
if (useShaders && ((hasVertex && foundVertex) || (hasFragment && foundFragment)) && (mFactory->getCurrentLanguage () == Language_GLSL
|| mFactory->getCurrentLanguage() == Language_GLSLES))
{
pass->setTextureUnitIndex (foundVertex ? GPT_Vertex : GPT_Fragment, texIt->getName(), i);

@ -9,8 +9,7 @@
/*
Almost exact copy of load_file_to_string policy found in
boost::wave headers with the only change that it uses
boost::filesystem facility to handle UTF-8 paths used
throughout OpenMW (bfs::fstream, bfs::path).
boost::filesystem facility to handle UTF-8 paths properly on windows.
Original namespace is used due to required bost::wave
internal symbols.

@ -1,8 +1,6 @@
#ifndef SH_PREPROCESSOR_H
#define SH_PREPROCESSOR_H
#include <stdint.h>
#include <string>
#include <vector>

Loading…
Cancel
Save