mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 08:22:09 +02:00
Introducing the unlit material
This commit is contained in:
parent
3c80767ec3
commit
2d573963bb
18 changed files with 109 additions and 163 deletions
|
@ -991,7 +991,6 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
|||
QString propname = subobject.name.data();
|
||||
int unknown = 0;
|
||||
if ( (propname == "Version")
|
||||
||(propname == "ShadingModel")
|
||||
||(propname == "Multilayer")) {
|
||||
} else {
|
||||
unknown++;
|
||||
|
|
|
@ -212,6 +212,13 @@ void FBXReader::consolidateFBXMaterials() {
|
|||
material._material->setRoughness(model::Material::shininessToRoughness(material.shininess));
|
||||
float metallic = std::max(material.specularColor.x, std::max(material.specularColor.y, material.specularColor.z));
|
||||
material._material->setMetallic(metallic);
|
||||
|
||||
if (material.shadingModel == "lambert") {
|
||||
if (!material._material->getKey().isAlbedo()) {
|
||||
material._material->setUnlit(true);
|
||||
std::cout << emissive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (material.opacity <= 0.0f) {
|
||||
|
|
|
@ -74,6 +74,11 @@ void Material::setOpacity(float opacity) {
|
|||
_schemaBuffer.edit<Schema>()._opacity = opacity;
|
||||
}
|
||||
|
||||
void Material::setUnlit(bool value) {
|
||||
_key.setUnlit(value);
|
||||
_schemaBuffer.edit<Schema>()._key = (uint32)_key._flags.to_ulong();
|
||||
}
|
||||
|
||||
void Material::setAlbedo(const Color& albedo, bool isSRGB) {
|
||||
_key.setAlbedo(glm::any(glm::greaterThan(albedo, Color(0.0f))));
|
||||
_schemaBuffer.edit<Schema>()._key = (uint32)_key._flags.to_ulong();
|
||||
|
|
|
@ -28,14 +28,15 @@ class MaterialKey {
|
|||
public:
|
||||
enum FlagBit {
|
||||
EMISSIVE_VAL_BIT = 0,
|
||||
UNLIT_VAL_BIT,
|
||||
ALBEDO_VAL_BIT,
|
||||
METALLIC_VAL_BIT,
|
||||
GLOSSY_VAL_BIT,
|
||||
OPACITY_VAL_BIT,
|
||||
OPACITY_MASK_MAP_BIT, // OPacity Map and Opacity MASK map are mutually exclusive
|
||||
OPACITY_MASK_MAP_BIT, // Opacity Map and Opacity MASK map are mutually exclusive
|
||||
OPACITY_TRANSLUCENT_MAP_BIT,
|
||||
|
||||
// THe map bits must be in the smae sequence as the enum names for the map channels
|
||||
// THe map bits must be in the same sequence as the enum names for the map channels
|
||||
EMISSIVE_MAP_BIT,
|
||||
ALBEDO_MAP_BIT,
|
||||
METALLIC_MAP_BIT,
|
||||
|
@ -74,9 +75,12 @@ public:
|
|||
MaterialKey build() const { return MaterialKey(_flags); }
|
||||
|
||||
Builder& withEmissive() { _flags.set(EMISSIVE_VAL_BIT); return (*this); }
|
||||
Builder& withUnlit() { _flags.set(UNLIT_VAL_BIT); return (*this); }
|
||||
|
||||
Builder& withAlbedo() { _flags.set(ALBEDO_VAL_BIT); return (*this); }
|
||||
Builder& withMetallic() { _flags.set(METALLIC_VAL_BIT); return (*this); }
|
||||
Builder& withGlossy() { _flags.set(GLOSSY_VAL_BIT); return (*this); }
|
||||
|
||||
Builder& withTranslucentFactor() { _flags.set(OPACITY_VAL_BIT); return (*this); }
|
||||
|
||||
Builder& withEmissiveMap() { _flags.set(EMISSIVE_MAP_BIT); return (*this); }
|
||||
|
@ -98,6 +102,9 @@ public:
|
|||
void setEmissive(bool value) { _flags.set(EMISSIVE_VAL_BIT, value); }
|
||||
bool isEmissive() const { return _flags[EMISSIVE_VAL_BIT]; }
|
||||
|
||||
void setUnlit(bool value) { _flags.set(UNLIT_VAL_BIT, value); }
|
||||
bool isUnlit() const { return _flags[UNLIT_VAL_BIT]; }
|
||||
|
||||
void setEmissiveMap(bool value) { _flags.set(EMISSIVE_MAP_BIT, value); }
|
||||
bool isEmissiveMap() const { return _flags[EMISSIVE_MAP_BIT]; }
|
||||
|
||||
|
@ -172,6 +179,9 @@ public:
|
|||
Builder& withoutEmissiveMap() { _value.reset(MaterialKey::EMISSIVE_MAP_BIT); _mask.set(MaterialKey::EMISSIVE_MAP_BIT); return (*this); }
|
||||
Builder& withEmissiveMap() { _value.set(MaterialKey::EMISSIVE_MAP_BIT); _mask.set(MaterialKey::EMISSIVE_MAP_BIT); return (*this); }
|
||||
|
||||
Builder& withoutUnlit() { _value.reset(MaterialKey::UNLIT_VAL_BIT); _mask.set(MaterialKey::UNLIT_VAL_BIT); return (*this); }
|
||||
Builder& withUnlit() { _value.set(MaterialKey::UNLIT_VAL_BIT); _mask.set(MaterialKey::UNLIT_VAL_BIT); return (*this); }
|
||||
|
||||
Builder& withoutAlbedo() { _value.reset(MaterialKey::ALBEDO_VAL_BIT); _mask.set(MaterialKey::ALBEDO_VAL_BIT); return (*this); }
|
||||
Builder& withAlbedo() { _value.set(MaterialKey::ALBEDO_VAL_BIT); _mask.set(MaterialKey::ALBEDO_VAL_BIT); return (*this); }
|
||||
|
||||
|
@ -250,6 +260,9 @@ public:
|
|||
void setOpacity(float opacity);
|
||||
float getOpacity() const { return _schemaBuffer.get<Schema>()._opacity; }
|
||||
|
||||
void setUnlit(bool value);
|
||||
bool isUnlit() const { return _key.isUnlit(); }
|
||||
|
||||
void setAlbedo(const Color& albedo, bool isSRGB = true);
|
||||
Color getAlbedo(bool SRGB = true) const { return (SRGB ? ColorUtils::tosRGBVec3(_schemaBuffer.get<Schema>()._albedo) : _schemaBuffer.get<Schema>()._albedo); }
|
||||
|
||||
|
|
|
@ -40,20 +40,21 @@ float getMaterialShininess(Material m) { return 1.0 - getMaterialRoughness(m); }
|
|||
int getMaterialKey(Material m) { return floatBitsToInt(m._spareKey.w); }
|
||||
|
||||
const int EMISSIVE_VAL_BIT = 0x00000001;
|
||||
const int ALBEDO_VAL_BIT = 0x00000002;
|
||||
const int METALLIC_VAL_BIT = 0x00000004;
|
||||
const int GLOSSY_VAL_BIT = 0x00000008;
|
||||
const int OPACITY_VAL_BIT = 0x00000010;
|
||||
const int OPACITY_MASK_MAP_BIT = 0x00000020;
|
||||
const int OPACITY_TRANSLUCENT_MAP_BIT = 0x00000040;
|
||||
const int UNLIT_VAL_BIT = 0x00000002;
|
||||
const int ALBEDO_VAL_BIT = 0x00000004;
|
||||
const int METALLIC_VAL_BIT = 0x00000008;
|
||||
const int GLOSSY_VAL_BIT = 0x00000010;
|
||||
const int OPACITY_VAL_BIT = 0x00000020;
|
||||
const int OPACITY_MASK_MAP_BIT = 0x00000040;
|
||||
const int OPACITY_TRANSLUCENT_MAP_BIT = 0x00000080;
|
||||
|
||||
const int EMISSIVE_MAP_BIT = 0x00000080;
|
||||
const int ALBEDO_MAP_BIT = 0x00000100;
|
||||
const int METALLIC_MAP_BIT = 0x00000200;
|
||||
const int ROUGHNESS_MAP_BIT = 0x00000400;
|
||||
const int NORMAL_MAP_BIT = 0x00000800;
|
||||
const int OCCLUSION_MAP_BIT = 0x00001000;
|
||||
const int LIGHTMAP_MAP_BIT = 0x00002000;
|
||||
const int EMISSIVE_MAP_BIT = 0x00000100;
|
||||
const int ALBEDO_MAP_BIT = 0x00000200;
|
||||
const int METALLIC_MAP_BIT = 0x00000400;
|
||||
const int ROUGHNESS_MAP_BIT = 0x00000800;
|
||||
const int NORMAL_MAP_BIT = 0x00001000;
|
||||
const int OCCLUSION_MAP_BIT = 0x00002000;
|
||||
const int LIGHTMAP_MAP_BIT = 0x00004000;
|
||||
|
||||
|
||||
<@endif@>
|
||||
|
|
|
@ -90,14 +90,14 @@ static const std::string DEFAULT_OCCLUSION_SHADER{
|
|||
static const std::string DEFAULT_EMISSIVE_SHADER{
|
||||
"vec4 getFragmentColor() {"
|
||||
" DeferredFragment frag = unpackDeferredFragmentNoPosition(uv);"
|
||||
" return (frag.mode != LIGHT_MAPPED ? vec4(pow(frag.emissive, vec3(1.0 / 2.2)), 1.0) : vec4(vec3(0.0), 1.0));"
|
||||
" return (frag.mode != FRAG_MODE_LIGHTMAPPED ? vec4(pow(frag.emissive, vec3(1.0 / 2.2)), 1.0) : vec4(vec3(0.0), 1.0));"
|
||||
" }"
|
||||
};
|
||||
|
||||
static const std::string DEFAULT_LIGHTMAP_SHADER{
|
||||
"vec4 getFragmentColor() {"
|
||||
" DeferredFragment frag = unpackDeferredFragmentNoPosition(uv);"
|
||||
" return (frag.mode == LIGHT_MAPPED ? vec4(frag.emissive, 1.0) : vec4(vec3(0.0), 1.0));"
|
||||
" return (frag.mode == FRAG_MODE_LIGHTMAPPED ? vec4(frag.emissive, 1.0) : vec4(vec3(0.0), 1.0));"
|
||||
" }"
|
||||
};
|
||||
|
||||
|
|
|
@ -11,135 +11,40 @@
|
|||
<@if not DEFERRED_BUFFER_SLH@>
|
||||
<@def DEFERRED_BUFFER_SLH@>
|
||||
|
||||
// Unpack the metallic-mode value
|
||||
const float FRAG_TYPE_UNLIT = 0.0;
|
||||
const float FRAG_TYPE_SHADED_NON_METALLIC = 0.1;
|
||||
const float FRAG_TYPE_SHADED_METALLIC = 0.2;
|
||||
const float FRAG_TYPE_SHADED_RANGE_INV = 1.0 / (FRAG_TYPE_SHADED_METALLIC - FRAG_TYPE_SHADED_NON_METALLIC);
|
||||
|
||||
// the albedo texture
|
||||
uniform sampler2D albedoMap;
|
||||
const float FRAG_TYPE_LIGHTMAPPED_NON_METALLIC = 0.3;
|
||||
const float FRAG_TYPE_LIGHTMAPPED_METALLIC = 0.4;
|
||||
const float FRAG_TYPE_LIGHTMAPPED_RANGE_INV = 1.0 / (FRAG_TYPE_LIGHTMAPPED_METALLIC - FRAG_TYPE_LIGHTMAPPED_NON_METALLIC);
|
||||
|
||||
// the normal texture
|
||||
uniform sampler2D normalMap;
|
||||
const int FRAG_MODE_UNLIT = 0;
|
||||
const int FRAG_MODE_SHADED = 1;
|
||||
const int FRAG_MODE_LIGHTMAPPED = 2;
|
||||
|
||||
// the specular texture
|
||||
uniform sampler2D specularMap;
|
||||
|
||||
// the depth texture
|
||||
uniform sampler2D depthMap;
|
||||
|
||||
// the obscurance texture
|
||||
uniform sampler2D obscuranceMap;
|
||||
|
||||
// the lighting texture
|
||||
uniform sampler2D lightingMap;
|
||||
|
||||
|
||||
struct DeferredTransform {
|
||||
mat4 projection;
|
||||
mat4 viewInverse;
|
||||
float stereoSide;
|
||||
vec3 _spareABC;
|
||||
};
|
||||
|
||||
layout(std140) uniform deferredTransformBuffer {
|
||||
DeferredTransform _deferredTransform;
|
||||
};
|
||||
DeferredTransform getDeferredTransform() {
|
||||
return _deferredTransform;
|
||||
}
|
||||
|
||||
bool getStereoMode(DeferredTransform deferredTransform) {
|
||||
return (deferredTransform.stereoSide != 0.0);
|
||||
}
|
||||
float getStereoSide(DeferredTransform deferredTransform) {
|
||||
return (deferredTransform.stereoSide);
|
||||
}
|
||||
|
||||
vec4 evalEyePositionFromZ(DeferredTransform deferredTransform, float depthVal, vec2 texcoord) {
|
||||
vec3 nPos = vec3(texcoord.xy * 2.0f - 1.0f, depthVal * 2.0f - 1.0f);
|
||||
|
||||
// compute the view space position using the depth
|
||||
// basically manually pick the proj matrix components to do the inverse
|
||||
float Ze = -deferredTransform.projection[3][2] / (nPos.z + deferredTransform.projection[2][2]);
|
||||
float Xe = (-Ze * nPos.x - Ze * deferredTransform.projection[2][0] - deferredTransform.projection[3][0]) / deferredTransform.projection[0][0];
|
||||
float Ye = (-Ze * nPos.y - Ze * deferredTransform.projection[2][1] - deferredTransform.projection[3][1]) / deferredTransform.projection[1][1];
|
||||
return vec4(Xe, Ye, Ze, 1.0f);
|
||||
}
|
||||
|
||||
struct DeferredFragment {
|
||||
vec4 normalVal;
|
||||
vec4 diffuseVal;
|
||||
vec4 specularVal;
|
||||
vec4 position;
|
||||
vec3 normal;
|
||||
float metallic;
|
||||
vec3 diffuse;
|
||||
float obscurance;
|
||||
vec3 specular;
|
||||
float roughness;
|
||||
vec3 emissive;
|
||||
int mode;
|
||||
float depthVal;
|
||||
};
|
||||
|
||||
const int LIGHT_MAPPED = 1;
|
||||
|
||||
vec4 unpackDeferredPosition(DeferredTransform deferredTransform, float depthValue, vec2 texcoord) {
|
||||
if (getStereoMode(deferredTransform)) {
|
||||
if (texcoord.x > 0.5) {
|
||||
texcoord.x -= 0.5;
|
||||
}
|
||||
texcoord.x *= 2.0;
|
||||
void unpackModeMetallic(float rawValue, out int mode, out float metallic) {
|
||||
if (rawValue < FRAG_TYPE_SHADED_NON_METALLIC) {
|
||||
mode = FRAG_MODE_UNLIT;
|
||||
metallic = 0.0;
|
||||
} else if (rawValue <= FRAG_TYPE_SHADED_METALLIC) {
|
||||
mode = FRAG_MODE_SHADED;
|
||||
metallic = clamp((rawValue - FRAG_TYPE_SHADED_NON_METALLIC) * FRAG_TYPE_SHADED_RANGE_INV, 0.0, 1.0);
|
||||
} else if (rawValue <= FRAG_TYPE_LIGHTMAPPED_METALLIC) {
|
||||
mode = FRAG_MODE_LIGHTMAPPED;
|
||||
metallic = clamp((rawValue - FRAG_TYPE_LIGHTMAPPED_NON_METALLIC) * FRAG_TYPE_SHADED_RANGE_INV, 0.0, 1.0);
|
||||
}
|
||||
return evalEyePositionFromZ(deferredTransform, depthValue, texcoord);
|
||||
}
|
||||
|
||||
DeferredFragment unpackDeferredFragmentNoPosition(vec2 texcoord) {
|
||||
|
||||
DeferredFragment frag;
|
||||
frag.depthVal = -1;
|
||||
frag.normalVal = texture(normalMap, texcoord);
|
||||
frag.diffuseVal = texture(albedoMap, texcoord);
|
||||
frag.specularVal = texture(specularMap, texcoord);
|
||||
frag.obscurance = texture(obscuranceMap, texcoord).x;
|
||||
|
||||
// Unpack the normal from the map
|
||||
frag.normal = normalize(frag.normalVal.xyz * 2.0 - vec3(1.0));
|
||||
|
||||
frag.mode = 0;
|
||||
frag.emissive = frag.specularVal.xyz;
|
||||
if (frag.normalVal.a < 0.5) {
|
||||
frag.mode = 0;
|
||||
frag.roughness = 2.0 * frag.normalVal.a;
|
||||
} else {
|
||||
frag.mode = LIGHT_MAPPED;
|
||||
frag.roughness = 2.0 * frag.normalVal.a - 1.0;
|
||||
}
|
||||
|
||||
frag.metallic = frag.diffuseVal.a;
|
||||
frag.diffuse = frag.diffuseVal.xyz;
|
||||
if (frag.metallic <= 0.5) {
|
||||
frag.metallic = 0.0;
|
||||
frag.specular = vec3(0.03); // Default Di-electric fresnel value
|
||||
} else {
|
||||
frag.specular = vec3(frag.diffuseVal.xyz);
|
||||
frag.metallic = 1.0;
|
||||
}
|
||||
frag.obscurance = min(frag.specularVal.w, frag.obscurance);
|
||||
|
||||
return frag;
|
||||
float packShadedMetallic(float metallic) {
|
||||
return mix(FRAG_TYPE_SHADED_NON_METALLIC, FRAG_TYPE_SHADED_METALLIC, metallic);
|
||||
}
|
||||
|
||||
DeferredFragment unpackDeferredFragment(DeferredTransform deferredTransform, vec2 texcoord) {
|
||||
|
||||
float depthValue = texture(depthMap, texcoord).r;
|
||||
|
||||
DeferredFragment frag = unpackDeferredFragmentNoPosition(texcoord);
|
||||
|
||||
frag.depthVal = depthValue;
|
||||
frag.position = unpackDeferredPosition(deferredTransform, frag.depthVal, texcoord);
|
||||
|
||||
return frag;
|
||||
float packLightmappedMetallic(float metallic) {
|
||||
return mix(FRAG_TYPE_LIGHTMAPPED_NON_METALLIC, FRAG_TYPE_LIGHTMAPPED_METALLIC, metallic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
<@endif@>
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
<@if not DEFERRED_BUFFER_WRITE_SLH@>
|
||||
<@def DEFERRED_BUFFER_WRITE_SLH@>
|
||||
|
||||
<@include DeferredBuffer.slh@>
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
layout(location = 1) out vec4 _fragColor1;
|
||||
layout(location = 2) out vec4 _fragColor2;
|
||||
|
@ -48,13 +50,12 @@ const vec3 DEFAULT_EMISSIVE = vec3(0.0);
|
|||
const float DEFAULT_OCCLUSION = 1.0;
|
||||
const vec3 DEFAULT_FRESNEL = DEFAULT_EMISSIVE;
|
||||
|
||||
|
||||
void packDeferredFragment(vec3 normal, float alpha, vec3 albedo, float roughness, float metallic, vec3 emissive, float occlusion) {
|
||||
if (alpha != 1.0) {
|
||||
discard;
|
||||
}
|
||||
_fragColor0 = vec4(albedo, metallic);
|
||||
_fragColor1 = vec4(bestFitNormal(normal), 0.5 * clamp(roughness, 0.0, 1.0));
|
||||
_fragColor0 = vec4(albedo, packShadedMetallic(metallic));
|
||||
_fragColor1 = vec4(bestFitNormal(normal), clamp(roughness, 0.0, 1.0));
|
||||
_fragColor2 = vec4(emissive, occlusion);
|
||||
}
|
||||
|
||||
|
@ -63,19 +64,25 @@ void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 albedo, float r
|
|||
if (alpha != 1.0) {
|
||||
discard;
|
||||
}
|
||||
_fragColor0 = vec4(albedo, metallic);
|
||||
_fragColor1 = vec4(bestFitNormal(normal), 0.5 + 0.5 * clamp(roughness, 0.0, 1.0));
|
||||
_fragColor0 = vec4(albedo, packLightmappedMetallic(metallic));
|
||||
_fragColor1 = vec4(bestFitNormal(normal), clamp(roughness, 0.0, 1.0));
|
||||
_fragColor2 = vec4(emissive, 1.0);
|
||||
}
|
||||
|
||||
void packDeferredFragmentUnlit(vec3 normal, float alpha, vec3 color) {
|
||||
if (alpha != 1.0) {
|
||||
discard;
|
||||
}
|
||||
_fragColor0 = vec4(color, FRAG_TYPE_UNLIT);
|
||||
_fragColor1 = vec4(bestFitNormal(normal), 1.0);
|
||||
//_fragColor2 = vec4(vec3(0.0), 1.0); // If unlit, do not worry about the emissive color target
|
||||
}
|
||||
|
||||
void packDeferredFragmentTranslucent(vec3 normal, float alpha, vec3 albedo, vec3 fresnel, float roughness) {
|
||||
if (alpha <= 0.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
}
|
||||
_fragColor0 = vec4(albedo.rgb, alpha);
|
||||
// _fragColor1 = vec4(normal, 0.0) * 0.5 + vec4(0.5, 0.5, 0.5, 1.0);
|
||||
// _fragColor2 = vec4(fresnel, roughness);
|
||||
}
|
||||
|
||||
<@endif@>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
|
||||
uniform sampler2D pyramidMap;
|
||||
uniform sampler2D occlusionMap;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
<@include DeferredGlobalLight.slh@>
|
||||
|
||||
<$declareEvalLightmappedColor()$>
|
||||
|
@ -27,7 +27,7 @@ void main(void) {
|
|||
|
||||
float shadowAttenuation = 1.0;
|
||||
|
||||
if (frag.mode == LIGHT_MAPPED) {
|
||||
if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//
|
||||
|
||||
<@include Shadow.slh@>
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
<@include DeferredGlobalLight.slh@>
|
||||
|
||||
<$declareEvalLightmappedColor()$>
|
||||
|
@ -29,7 +29,7 @@ void main(void) {
|
|||
vec4 worldPos = deferredTransform.viewInverse * vec4(frag.position.xyz, 1.0);
|
||||
float shadowAttenuation = evalShadowAttenuation(worldPos);
|
||||
|
||||
if (frag.mode == LIGHT_MAPPED) {
|
||||
if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
<@include DeferredGlobalLight.slh@>
|
||||
|
||||
<$declareEvalLightmappedColor()$>
|
||||
|
@ -28,7 +28,7 @@ void main(void) {
|
|||
float shadowAttenuation = 1.0;
|
||||
|
||||
// Light mapped or not ?
|
||||
if (frag.mode == LIGHT_MAPPED) {
|
||||
if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//
|
||||
|
||||
<@include Shadow.slh@>
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
<@include DeferredGlobalLight.slh@>
|
||||
|
||||
<$declareEvalLightmappedColor()$>
|
||||
|
@ -30,7 +30,7 @@ void main(void) {
|
|||
float shadowAttenuation = evalShadowAttenuation(worldPos);
|
||||
|
||||
// Light mapped or not ?
|
||||
if (frag.mode == LIGHT_MAPPED) {
|
||||
if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
<@include DeferredGlobalLight.slh@>
|
||||
|
||||
<$declareEvalLightmappedColor()$>
|
||||
|
@ -28,7 +28,7 @@ void main(void) {
|
|||
float shadowAttenuation = 1.0;
|
||||
|
||||
// Light mapped or not ?
|
||||
if (frag.mode == LIGHT_MAPPED) {
|
||||
if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//!>
|
||||
|
||||
<@include Shadow.slh@>
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
<@include DeferredGlobalLight.slh@>
|
||||
|
||||
<$declareEvalLightmappedColor()$>
|
||||
|
@ -30,7 +30,7 @@ void main(void) {
|
|||
float shadowAttenuation = evalShadowAttenuation(worldPos);
|
||||
|
||||
// Light mapped or not ?
|
||||
if (frag.mode == LIGHT_MAPPED) {
|
||||
if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//
|
||||
|
||||
// Everything about deferred buffer
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
|
||||
//Everything about deferred lighting
|
||||
<@include DeferredLighting.slh@>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//
|
||||
|
||||
// Everything about deferred buffer
|
||||
<@include DeferredBuffer.slh@>
|
||||
<@include DeferredBufferRead.slh@>
|
||||
|
||||
//Everything about deferred lighting
|
||||
<@include DeferredLighting.slh@>
|
||||
|
|
|
@ -191,10 +191,19 @@ int main (int argc, char** argv) {
|
|||
targetStringStream << "#ifndef scribe_" << targetName << "_h" << std::endl;
|
||||
targetStringStream << "#define scribe_" << targetName << "_h" << std::endl << std::endl;
|
||||
|
||||
// targetStringStream << "const char " << targetName << "[] = R\"XXXX(" << destStringStream.str() << ")XXXX\";";
|
||||
std::istringstream destStringStreamAgain(destStringStream.str());
|
||||
targetStringStream << "const char " << targetName << "[] = \n";
|
||||
while (!destStringStreamAgain.eof()) {
|
||||
std::string lineToken;
|
||||
std::getline(destStringStreamAgain, lineToken);
|
||||
targetStringStream << "R\"XXX(" << lineToken << ")XXX\"\"\\n\"\n";
|
||||
}
|
||||
targetStringStream << ";\n" << std::endl << std::endl;
|
||||
/*
|
||||
targetStringStream << "const char " << targetName << "[] = R\"SCRIBE(";
|
||||
targetStringStream << destStringStream.str();
|
||||
targetStringStream << "\n)SCRIBE\";\n\n";
|
||||
*/
|
||||
targetStringStream << "#endif" << std::endl;
|
||||
} else {
|
||||
targetStringStream << destStringStream.str();
|
||||
|
|
Loading…
Reference in a new issue