mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Sync upstream changes to shiny
This commit is contained in:
parent
44b517f66d
commit
c5a9cd0aa1
7 changed files with 34 additions and 26 deletions
6
extern/shiny/Extra/core.h
vendored
6
extern/shiny/Extra/core.h
vendored
|
@ -1,6 +1,7 @@
|
||||||
#if SH_HLSL == 1 || SH_CG == 1
|
#if SH_HLSL == 1 || SH_CG == 1
|
||||||
|
|
||||||
#define shTexture2D sampler2D
|
#define shTexture2D sampler2D
|
||||||
|
#define shTexture3D sampler3D
|
||||||
#define shSample(tex, coord) tex2D(tex, coord)
|
#define shSample(tex, coord) tex2D(tex, coord)
|
||||||
#define shCubicSample(tex, coord) texCUBE(tex, coord)
|
#define shCubicSample(tex, coord) texCUBE(tex, coord)
|
||||||
#define shLerp(a, b, t) lerp(a, b, t)
|
#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 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 shSamplerCube(name) , uniform samplerCUBE name : register(s@shCounter(0)) @shUseSampler(name)
|
||||||
|
|
||||||
#define shMatrixMult(m, v) mul(m, v)
|
#define shMatrixMult(m, v) mul(m, v)
|
||||||
|
@ -67,6 +70,7 @@
|
||||||
#define int3 ivec3
|
#define int3 ivec3
|
||||||
#define int4 ivec4
|
#define int4 ivec4
|
||||||
#define shTexture2D sampler2D
|
#define shTexture2D sampler2D
|
||||||
|
#define shTexture3D sampler3D
|
||||||
#define shSample(tex, coord) texture2D(tex, coord)
|
#define shSample(tex, coord) texture2D(tex, coord)
|
||||||
#define shCubicSample(tex, coord) textureCube(tex, coord)
|
#define shCubicSample(tex, coord) textureCube(tex, coord)
|
||||||
#define shLerp(a, b, t) mix(a, b, t)
|
#define shLerp(a, b, t) mix(a, b, t)
|
||||||
|
@ -76,6 +80,8 @@
|
||||||
|
|
||||||
#define shSampler2D(name) uniform sampler2D name; @shUseSampler(name)
|
#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 shSamplerCube(name) uniform samplerCube name; @shUseSampler(name)
|
||||||
|
|
||||||
#define shMatrixMult(m, v) (m * v)
|
#define shMatrixMult(m, v) (m * v)
|
||||||
|
|
28
extern/shiny/Main/Factory.cpp
vendored
28
extern/shiny/Main/Factory.cpp
vendored
|
@ -284,8 +284,9 @@ namespace sh
|
||||||
|
|
||||||
MaterialInstance* Factory::findInstance (const std::string& name)
|
MaterialInstance* Factory::findInstance (const std::string& name)
|
||||||
{
|
{
|
||||||
assert (mMaterials.find(name) != mMaterials.end());
|
MaterialInstance* m = searchInstance(name);
|
||||||
return &mMaterials.find(name)->second;
|
assert (m);
|
||||||
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialInstance* Factory::requestMaterial (const std::string& name, const std::string& configuration, unsigned short lodIndex)
|
MaterialInstance* Factory::requestMaterial (const std::string& name, const std::string& configuration, unsigned short lodIndex)
|
||||||
|
@ -297,28 +298,25 @@ namespace sh
|
||||||
|
|
||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
// make sure all lod techniques below (higher lod) exist
|
if (m->createForConfiguration (configuration, 0))
|
||||||
int i = lodIndex;
|
|
||||||
while (i>0)
|
|
||||||
{
|
|
||||||
--i;
|
|
||||||
if (m->createForConfiguration (configuration, i))
|
|
||||||
{
|
{
|
||||||
if (mListener)
|
if (mListener)
|
||||||
mListener->materialCreated (m, configuration, i);
|
mListener->materialCreated (m, configuration, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return NULL;
|
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)
|
if (mListener)
|
||||||
mListener->materialCreated (m, configuration, lodIndex);
|
mListener->materialCreated (m, configuration, it->first);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +623,13 @@ namespace sh
|
||||||
{
|
{
|
||||||
MaterialInstance* m = searchInstance (name);
|
MaterialInstance* m = searchInstance (name);
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
m->createForConfiguration (configuration, 0);
|
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)
|
bool Factory::removeCache(const std::string& pattern)
|
||||||
|
|
2
extern/shiny/Main/Factory.hpp
vendored
2
extern/shiny/Main/Factory.hpp
vendored
|
@ -259,8 +259,8 @@ namespace sh
|
||||||
Platform* mPlatform;
|
Platform* mPlatform;
|
||||||
|
|
||||||
MaterialInstance* findInstance (const std::string& name);
|
MaterialInstance* findInstance (const std::string& name);
|
||||||
private:
|
|
||||||
MaterialInstance* searchInstance (const std::string& name);
|
MaterialInstance* searchInstance (const std::string& name);
|
||||||
|
|
||||||
/// @return was anything removed?
|
/// @return was anything removed?
|
||||||
bool removeCache (const std::string& pattern);
|
bool removeCache (const std::string& pattern);
|
||||||
|
|
||||||
|
|
3
extern/shiny/Main/MaterialInstance.cpp
vendored
3
extern/shiny/Main/MaterialInstance.cpp
vendored
|
@ -163,7 +163,8 @@ namespace sh
|
||||||
mTexUnits.push_back(texUnit);
|
mTexUnits.push_back(texUnit);
|
||||||
|
|
||||||
// set texture unit indices (required by GLSL)
|
// 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);
|
pass->setTextureUnitIndex (foundVertex ? GPT_Vertex : GPT_Fragment, texIt->getName(), i);
|
||||||
|
|
||||||
|
|
3
extern/shiny/Main/Preprocessor.cpp
vendored
3
extern/shiny/Main/Preprocessor.cpp
vendored
|
@ -9,8 +9,7 @@
|
||||||
/*
|
/*
|
||||||
Almost exact copy of load_file_to_string policy found in
|
Almost exact copy of load_file_to_string policy found in
|
||||||
boost::wave headers with the only change that it uses
|
boost::wave headers with the only change that it uses
|
||||||
boost::filesystem facility to handle UTF-8 paths used
|
boost::filesystem facility to handle UTF-8 paths properly on windows.
|
||||||
throughout OpenMW (bfs::fstream, bfs::path).
|
|
||||||
|
|
||||||
Original namespace is used due to required bost::wave
|
Original namespace is used due to required bost::wave
|
||||||
internal symbols.
|
internal symbols.
|
||||||
|
|
2
extern/shiny/Main/Preprocessor.hpp
vendored
2
extern/shiny/Main/Preprocessor.hpp
vendored
|
@ -1,8 +1,6 @@
|
||||||
#ifndef SH_PREPROCESSOR_H
|
#ifndef SH_PREPROCESSOR_H
|
||||||
#define SH_PREPROCESSOR_H
|
#define SH_PREPROCESSOR_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue