i
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "132d857c-9659-46c1-868d-3a0192ed37dd",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "132d857c-9659-46c1-868d-3a0192ed37dd",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,113 +1,113 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
|
||||
// TODO: lights uniform should move back to cc-global
|
||||
|
||||
#include <builtin/uniforms/cc-shadow>
|
||||
#if CC_SUPPORT_CASCADED_SHADOW_MAP
|
||||
#include <builtin/uniforms/cc-csm>
|
||||
#endif
|
||||
|
||||
#pragma define CC_MAX_LIGHTS 4
|
||||
|
||||
#if CC_NUM_LIGHTS > 0
|
||||
|
||||
// directional lights
|
||||
#pragma builtin(global)
|
||||
uniform CCLIGHTS {
|
||||
vec4 cc_lightPositionAndRange[CC_MAX_LIGHTS]; // xyz range
|
||||
vec4 cc_lightDirection[CC_MAX_LIGHTS]; // xyz spotAngle
|
||||
vec4 cc_lightColor[CC_MAX_LIGHTS]; // xyz spotExp
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
struct LightInfo {
|
||||
vec3 lightDir;
|
||||
vec3 radiance;
|
||||
vec4 lightColor;
|
||||
};
|
||||
|
||||
// directional light
|
||||
LightInfo computeDirectionalLighting(
|
||||
vec4 lightDirection,
|
||||
vec4 lightColor
|
||||
) {
|
||||
LightInfo ret;
|
||||
ret.lightDir = -normalize(lightDirection.xyz);
|
||||
ret.radiance = lightColor.rgb;
|
||||
ret.lightColor = lightColor;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// point light
|
||||
LightInfo computePointLighting(
|
||||
vec3 worldPosition,
|
||||
vec4 lightPositionAndRange,
|
||||
vec4 lightColor
|
||||
) {
|
||||
LightInfo ret;
|
||||
vec3 lightDir = lightPositionAndRange.xyz - worldPosition;
|
||||
float attenuation = max(0., 1.0 - length(lightDir) / lightPositionAndRange.w);
|
||||
|
||||
ret.lightDir = normalize(lightDir);
|
||||
ret.radiance = lightColor.rgb * attenuation;
|
||||
ret.lightColor = lightColor;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// spot light
|
||||
LightInfo computeSpotLighting(
|
||||
vec3 worldPosition,
|
||||
vec4 lightPositionAndRange,
|
||||
vec4 lightDirection,
|
||||
vec4 lightColor
|
||||
) {
|
||||
LightInfo ret;
|
||||
vec3 lightDir = lightPositionAndRange.xyz - worldPosition;
|
||||
float attenuation = max(0., 1.0 - length(lightDir) / lightPositionAndRange.w);
|
||||
lightDir = normalize(lightDir);
|
||||
float cosConeAngle = max(0., dot(lightDirection.xyz, -lightDir));
|
||||
cosConeAngle = cosConeAngle < lightDirection.w ? 0. : cosConeAngle;
|
||||
cosConeAngle = pow(cosConeAngle, lightColor.w);
|
||||
|
||||
ret.lightDir = lightDir;
|
||||
ret.radiance = lightColor.rgb * attenuation * cosConeAngle;
|
||||
ret.lightColor = lightColor;
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct Lighting {
|
||||
vec3 diffuse;
|
||||
vec3 specular;
|
||||
};
|
||||
|
||||
#pragma define CC_CALC_LIGHT(index, surface, result, lightFunc, ambientFunc) \
|
||||
#if CC_NUM_LIGHTS > index \
|
||||
#if CC_LIGHT_##index##_TYPE == 3 \
|
||||
result.diffuse += ambientFunc(s, cc_lightColor[index]); \
|
||||
#else \
|
||||
LightInfo info##index; \
|
||||
#if CC_LIGHT_##index##_TYPE == 0 \
|
||||
info##index = computeDirectionalLighting(cc_lightDirection[index], cc_lightColor[index]); \
|
||||
#elif CC_LIGHT_##index##_TYPE == 1 \
|
||||
info##index = computePointLighting(s.position, cc_lightPositionAndRange[index], cc_lightColor[index]); \
|
||||
#elif CC_LIGHT_##index##_TYPE == 2 \
|
||||
info##index = computeSpotLighting(s.position, cc_lightPositionAndRange[index], cc_lightDirection[index], cc_lightColor[index]); \
|
||||
#endif \
|
||||
\
|
||||
Lighting result##index = lightFunc(surface, info##index); \
|
||||
CC_CALC_SHADOW(index, result##index) \
|
||||
result.diffuse += result##index.diffuse; \
|
||||
result.specular += result##index.specular; \
|
||||
#endif \
|
||||
#endif
|
||||
|
||||
#pragma define CC_CALC_LIGHTS(surface, result, lightFunc, ambientFunc) \
|
||||
result.diffuse = vec3(0, 0, 0); \
|
||||
result.specular = vec3(0, 0, 0); \
|
||||
\
|
||||
CC_CALC_LIGHT(0, surface, result, lightFunc, ambientFunc) \
|
||||
CC_CALC_LIGHT(1, surface, result, lightFunc, ambientFunc) \
|
||||
CC_CALC_LIGHT(2, surface, result, lightFunc, ambientFunc) \
|
||||
CC_CALC_LIGHT(3, surface, result, lightFunc, ambientFunc)
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
|
||||
// TODO: lights uniform should move back to cc-global
|
||||
|
||||
#include <builtin/uniforms/cc-shadow>
|
||||
#if CC_SUPPORT_CASCADED_SHADOW_MAP
|
||||
#include <builtin/uniforms/cc-csm>
|
||||
#endif
|
||||
|
||||
#pragma define CC_MAX_LIGHTS 4
|
||||
|
||||
#if CC_NUM_LIGHTS > 0
|
||||
|
||||
// directional lights
|
||||
#pragma builtin(global)
|
||||
uniform CCLIGHTS {
|
||||
vec4 cc_lightPositionAndRange[CC_MAX_LIGHTS]; // xyz range
|
||||
vec4 cc_lightDirection[CC_MAX_LIGHTS]; // xyz spotAngle
|
||||
vec4 cc_lightColor[CC_MAX_LIGHTS]; // xyz spotExp
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
struct LightInfo {
|
||||
vec3 lightDir;
|
||||
vec3 radiance;
|
||||
vec4 lightColor;
|
||||
};
|
||||
|
||||
// directional light
|
||||
LightInfo computeDirectionalLighting(
|
||||
vec4 lightDirection,
|
||||
vec4 lightColor
|
||||
) {
|
||||
LightInfo ret;
|
||||
ret.lightDir = -normalize(lightDirection.xyz);
|
||||
ret.radiance = lightColor.rgb;
|
||||
ret.lightColor = lightColor;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// point light
|
||||
LightInfo computePointLighting(
|
||||
vec3 worldPosition,
|
||||
vec4 lightPositionAndRange,
|
||||
vec4 lightColor
|
||||
) {
|
||||
LightInfo ret;
|
||||
vec3 lightDir = lightPositionAndRange.xyz - worldPosition;
|
||||
float attenuation = max(0., 1.0 - length(lightDir) / lightPositionAndRange.w);
|
||||
|
||||
ret.lightDir = normalize(lightDir);
|
||||
ret.radiance = lightColor.rgb * attenuation;
|
||||
ret.lightColor = lightColor;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// spot light
|
||||
LightInfo computeSpotLighting(
|
||||
vec3 worldPosition,
|
||||
vec4 lightPositionAndRange,
|
||||
vec4 lightDirection,
|
||||
vec4 lightColor
|
||||
) {
|
||||
LightInfo ret;
|
||||
vec3 lightDir = lightPositionAndRange.xyz - worldPosition;
|
||||
float attenuation = max(0., 1.0 - length(lightDir) / lightPositionAndRange.w);
|
||||
lightDir = normalize(lightDir);
|
||||
float cosConeAngle = max(0., dot(lightDirection.xyz, -lightDir));
|
||||
cosConeAngle = cosConeAngle < lightDirection.w ? 0. : cosConeAngle;
|
||||
cosConeAngle = pow(cosConeAngle, lightColor.w);
|
||||
|
||||
ret.lightDir = lightDir;
|
||||
ret.radiance = lightColor.rgb * attenuation * cosConeAngle;
|
||||
ret.lightColor = lightColor;
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct Lighting {
|
||||
vec3 diffuse;
|
||||
vec3 specular;
|
||||
};
|
||||
|
||||
#pragma define CC_CALC_LIGHT(index, surface, result, lightFunc, ambientFunc) \
|
||||
#if CC_NUM_LIGHTS > index \
|
||||
#if CC_LIGHT_##index##_TYPE == 3 \
|
||||
result.diffuse += ambientFunc(s, cc_lightColor[index]); \
|
||||
#else \
|
||||
LightInfo info##index; \
|
||||
#if CC_LIGHT_##index##_TYPE == 0 \
|
||||
info##index = computeDirectionalLighting(cc_lightDirection[index], cc_lightColor[index]); \
|
||||
#elif CC_LIGHT_##index##_TYPE == 1 \
|
||||
info##index = computePointLighting(s.position, cc_lightPositionAndRange[index], cc_lightColor[index]); \
|
||||
#elif CC_LIGHT_##index##_TYPE == 2 \
|
||||
info##index = computeSpotLighting(s.position, cc_lightPositionAndRange[index], cc_lightDirection[index], cc_lightColor[index]); \
|
||||
#endif \
|
||||
\
|
||||
Lighting result##index = lightFunc(surface, info##index); \
|
||||
CC_CALC_SHADOW(index, result##index) \
|
||||
result.diffuse += result##index.diffuse; \
|
||||
result.specular += result##index.specular; \
|
||||
#endif \
|
||||
#endif
|
||||
|
||||
#pragma define CC_CALC_LIGHTS(surface, result, lightFunc, ambientFunc) \
|
||||
result.diffuse = vec3(0, 0, 0); \
|
||||
result.specular = vec3(0, 0, 0); \
|
||||
\
|
||||
CC_CALC_LIGHT(0, surface, result, lightFunc, ambientFunc) \
|
||||
CC_CALC_LIGHT(1, surface, result, lightFunc, ambientFunc) \
|
||||
CC_CALC_LIGHT(2, surface, result, lightFunc, ambientFunc) \
|
||||
CC_CALC_LIGHT(3, surface, result, lightFunc, ambientFunc)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "5db50634-6442-49cb-965f-a60f7ca2e829",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "5db50634-6442-49cb-965f-a60f7ca2e829",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
#include <common/common-define>
|
||||
|
||||
struct StandardVertInput {
|
||||
highp vec4 position;
|
||||
vec3 normal;
|
||||
vec4 tangent;
|
||||
vec4 color;
|
||||
vec2 uv;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec3 a_normal;
|
||||
layout(location = 2) in vec2 a_texCoord;
|
||||
layout(location = 3) in vec4 a_tangent;
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
#include <common/common-define>
|
||||
|
||||
struct StandardVertInput {
|
||||
highp vec4 position;
|
||||
vec3 normal;
|
||||
vec4 tangent;
|
||||
vec4 color;
|
||||
vec2 uv;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec3 a_normal;
|
||||
layout(location = 2) in vec2 a_texCoord;
|
||||
layout(location = 3) in vec4 a_tangent;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "fe05802b-a9e3-4064-9556-33ceef3cfd01",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "fe05802b-a9e3-4064-9556-33ceef3cfd01",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,102 +1,102 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <texture>
|
||||
#include <legacy/output>
|
||||
#include <builtin/internal/alpha-test>
|
||||
|
||||
uniform PhongFrag {
|
||||
lowp vec4 diffuseColor;
|
||||
lowp vec4 specularColor;
|
||||
lowp vec4 emissiveColor;
|
||||
float glossiness;
|
||||
};
|
||||
|
||||
#if USE_DIFFUSE_TEXTURE
|
||||
uniform sampler2D diffuseTexture;
|
||||
#endif
|
||||
|
||||
#if USE_SPECULAR && USE_SPECULAR_TEXTURE
|
||||
uniform sampler2D specularTexture;
|
||||
#endif
|
||||
|
||||
#if USE_EMISSIVE && USE_EMISSIVE_TEXTURE
|
||||
uniform sampler2D emissiveTexture;
|
||||
#endif
|
||||
|
||||
#if USE_NORMAL_TEXTURE
|
||||
in vec3 v_tangent;
|
||||
in vec3 v_bitangent;
|
||||
uniform sampler2D normalTexture;
|
||||
#endif
|
||||
|
||||
#pragma define CC_USE_TEXTURE CC_USE_ATTRIBUTE_UV0 && (USE_DIFFUSE_TEXTURE || (USE_EMISSIVE && USE_EMISSIVE_TEXTURE) || (USE_SPECULAR && USE_SPECULAR_TEXTURE) || USE_NORMAL_TEXTURE)
|
||||
|
||||
in vec3 v_worldNormal;
|
||||
in vec3 v_worldPos;
|
||||
in vec3 v_viewDirection;
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
in mediump vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
in lowp vec4 v_color;
|
||||
#endif
|
||||
|
||||
#include <shading-phong>
|
||||
|
||||
void surf (out PhongSurface s) {
|
||||
vec4 diffuse = vec4(1, 1, 1, 1);
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
diffuse *= v_color;
|
||||
#endif
|
||||
|
||||
diffuse *= diffuseColor;
|
||||
#if USE_DIFFUSE_TEXTURE
|
||||
CCTexture(diffuseTexture, v_uv0, diffuse);
|
||||
#endif
|
||||
|
||||
ALPHA_TEST(diffuse);
|
||||
|
||||
s.diffuse = diffuse.rgb;
|
||||
s.opacity = diffuse.a;
|
||||
|
||||
#if USE_EMISSIVE
|
||||
s.emissive = emissiveColor.rgb;
|
||||
#if USE_EMISSIVE_TEXTURE
|
||||
CCTextureRGB(emissiveTexture, v_uv0, s.emissive);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if USE_SPECULAR
|
||||
s.specular = specularColor.rgb;
|
||||
#if USE_SPECULAR_TEXTURE
|
||||
CCTextureRGB(specularTexture, v_uv0, s.specular);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
s.normal = v_worldNormal;
|
||||
#if USE_NORMAL_TEXTURE
|
||||
vec3 nmmp = texture(normalTexture, v_uv0).xyz - vec3(0.5);
|
||||
s.normal =
|
||||
nmmp.x * normalize(v_tangent) +
|
||||
nmmp.y * normalize(v_bitangent) +
|
||||
nmmp.z * normalize(s.normal);
|
||||
s.normal = normalize(s.normal);
|
||||
#endif
|
||||
|
||||
s.position = v_worldPos;
|
||||
s.viewDirection = v_viewDirection;
|
||||
s.glossiness = glossiness;
|
||||
}
|
||||
|
||||
void main () {
|
||||
PhongSurface s;
|
||||
surf(s);
|
||||
vec4 color = CCPhongShading(s);
|
||||
gl_FragColor = CCFragOutput(color);
|
||||
}
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <texture>
|
||||
#include <legacy/output>
|
||||
#include <builtin/internal/alpha-test>
|
||||
|
||||
uniform PhongFrag {
|
||||
lowp vec4 diffuseColor;
|
||||
lowp vec4 specularColor;
|
||||
lowp vec4 emissiveColor;
|
||||
float glossiness;
|
||||
};
|
||||
|
||||
#if USE_DIFFUSE_TEXTURE
|
||||
uniform sampler2D diffuseTexture;
|
||||
#endif
|
||||
|
||||
#if USE_SPECULAR && USE_SPECULAR_TEXTURE
|
||||
uniform sampler2D specularTexture;
|
||||
#endif
|
||||
|
||||
#if USE_EMISSIVE && USE_EMISSIVE_TEXTURE
|
||||
uniform sampler2D emissiveTexture;
|
||||
#endif
|
||||
|
||||
#if USE_NORMAL_TEXTURE
|
||||
in vec3 v_tangent;
|
||||
in vec3 v_bitangent;
|
||||
uniform sampler2D normalTexture;
|
||||
#endif
|
||||
|
||||
#pragma define CC_USE_TEXTURE CC_USE_ATTRIBUTE_UV0 && (USE_DIFFUSE_TEXTURE || (USE_EMISSIVE && USE_EMISSIVE_TEXTURE) || (USE_SPECULAR && USE_SPECULAR_TEXTURE) || USE_NORMAL_TEXTURE)
|
||||
|
||||
in vec3 v_worldNormal;
|
||||
in vec3 v_worldPos;
|
||||
in vec3 v_viewDirection;
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
in mediump vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
in lowp vec4 v_color;
|
||||
#endif
|
||||
|
||||
#include <shading-phong>
|
||||
|
||||
void surf (out PhongSurface s) {
|
||||
vec4 diffuse = vec4(1, 1, 1, 1);
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
diffuse *= v_color;
|
||||
#endif
|
||||
|
||||
diffuse *= diffuseColor;
|
||||
#if USE_DIFFUSE_TEXTURE
|
||||
CCTexture(diffuseTexture, v_uv0, diffuse);
|
||||
#endif
|
||||
|
||||
ALPHA_TEST(diffuse);
|
||||
|
||||
s.diffuse = diffuse.rgb;
|
||||
s.opacity = diffuse.a;
|
||||
|
||||
#if USE_EMISSIVE
|
||||
s.emissive = emissiveColor.rgb;
|
||||
#if USE_EMISSIVE_TEXTURE
|
||||
CCTextureRGB(emissiveTexture, v_uv0, s.emissive);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if USE_SPECULAR
|
||||
s.specular = specularColor.rgb;
|
||||
#if USE_SPECULAR_TEXTURE
|
||||
CCTextureRGB(specularTexture, v_uv0, s.specular);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
s.normal = v_worldNormal;
|
||||
#if USE_NORMAL_TEXTURE
|
||||
vec3 nmmp = texture(normalTexture, v_uv0).xyz - vec3(0.5);
|
||||
s.normal =
|
||||
nmmp.x * normalize(v_tangent) +
|
||||
nmmp.y * normalize(v_bitangent) +
|
||||
nmmp.z * normalize(s.normal);
|
||||
s.normal = normalize(s.normal);
|
||||
#endif
|
||||
|
||||
s.position = v_worldPos;
|
||||
s.viewDirection = v_viewDirection;
|
||||
s.glossiness = glossiness;
|
||||
}
|
||||
|
||||
void main () {
|
||||
PhongSurface s;
|
||||
surf(s);
|
||||
vec4 color = CCPhongShading(s);
|
||||
gl_FragColor = CCFragOutput(color);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "87ed45d3-2803-4a57-bfb2-57a241523edb",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "87ed45d3-2803-4a57-bfb2-57a241523edb",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <builtin/uniforms/cc-local>
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <legacy/input-standard>
|
||||
#include <builtin/uniforms/cc-shadow>
|
||||
#if CC_SUPPORT_CASCADED_SHADOW_MAP
|
||||
#include <builtin/uniforms/cc-csm>
|
||||
#endif
|
||||
|
||||
#pragma define CC_USE_TEXTURE CC_USE_ATTRIBUTE_UV0 && (USE_DIFFUSE_TEXTURE || USE_EMISSIVE_TEXTURE || USE_SPECULAR_TEXTURE || USE_NORMAL_TEXTURE)
|
||||
|
||||
uniform MAIN_TILING {
|
||||
vec2 mainTiling;
|
||||
vec2 mainOffset;
|
||||
};
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
out mediump vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
out lowp vec4 v_color;
|
||||
#endif
|
||||
|
||||
#if USE_NORMAL_TEXTURE
|
||||
out vec3 v_tangent;
|
||||
out vec3 v_bitangent;
|
||||
#endif
|
||||
|
||||
out vec3 v_worldNormal;
|
||||
out vec3 v_worldPos;
|
||||
out vec3 v_viewDirection;
|
||||
|
||||
void main () {
|
||||
StandardVertInput In;
|
||||
CCVertInput(In);
|
||||
|
||||
vec4 position = In.position;
|
||||
|
||||
v_worldNormal = normalize((cc_matWorldIT * vec4(In.normal, 0)).xyz);
|
||||
v_worldPos = (cc_matWorld * position).xyz;
|
||||
v_viewDirection = normalize(cc_cameraPos.xyz - v_worldPos);
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
v_uv0 = In.uv * mainTiling + mainOffset;
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
v_color = In.color;
|
||||
#endif
|
||||
|
||||
#if USE_NORMAL_TEXTURE
|
||||
v_tangent = normalize((cc_matWorld * vec4(In.tangent.xyz, 0.0)).xyz);
|
||||
v_bitangent = cross(v_worldNormal, v_tangent) * In.tangent.w; // note the cross order
|
||||
#endif
|
||||
|
||||
CCShadowInput(v_worldPos);
|
||||
|
||||
gl_Position = cc_matViewProj * cc_matWorld * position;
|
||||
}
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <builtin/uniforms/cc-local>
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <legacy/input-standard>
|
||||
#include <builtin/uniforms/cc-shadow>
|
||||
#if CC_SUPPORT_CASCADED_SHADOW_MAP
|
||||
#include <builtin/uniforms/cc-csm>
|
||||
#endif
|
||||
|
||||
#pragma define CC_USE_TEXTURE CC_USE_ATTRIBUTE_UV0 && (USE_DIFFUSE_TEXTURE || USE_EMISSIVE_TEXTURE || USE_SPECULAR_TEXTURE || USE_NORMAL_TEXTURE)
|
||||
|
||||
uniform MAIN_TILING {
|
||||
vec2 mainTiling;
|
||||
vec2 mainOffset;
|
||||
};
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
out mediump vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
out lowp vec4 v_color;
|
||||
#endif
|
||||
|
||||
#if USE_NORMAL_TEXTURE
|
||||
out vec3 v_tangent;
|
||||
out vec3 v_bitangent;
|
||||
#endif
|
||||
|
||||
out vec3 v_worldNormal;
|
||||
out vec3 v_worldPos;
|
||||
out vec3 v_viewDirection;
|
||||
|
||||
void main () {
|
||||
StandardVertInput In;
|
||||
CCVertInput(In);
|
||||
|
||||
vec4 position = In.position;
|
||||
|
||||
v_worldNormal = normalize((cc_matWorldIT * vec4(In.normal, 0)).xyz);
|
||||
v_worldPos = (cc_matWorld * position).xyz;
|
||||
v_viewDirection = normalize(cc_cameraPos.xyz - v_worldPos);
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
v_uv0 = In.uv * mainTiling + mainOffset;
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
v_color = In.color;
|
||||
#endif
|
||||
|
||||
#if USE_NORMAL_TEXTURE
|
||||
v_tangent = normalize((cc_matWorld * vec4(In.tangent.xyz, 0.0)).xyz);
|
||||
v_bitangent = cross(v_worldNormal, v_tangent) * In.tangent.w; // note the cross order
|
||||
#endif
|
||||
|
||||
CCShadowInput(v_worldPos);
|
||||
|
||||
gl_Position = cc_matViewProj * cc_matWorld * position;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "1b421c02-9e61-4235-9479-a81cde9d35ff",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "1b421c02-9e61-4235-9479-a81cde9d35ff",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
|
||||
#include <cc-lights>
|
||||
|
||||
struct PhongSurface {
|
||||
vec3 diffuse;
|
||||
vec3 emissive;
|
||||
vec3 specular;
|
||||
float opacity;
|
||||
|
||||
float glossiness;
|
||||
|
||||
vec3 position;
|
||||
vec3 normal;
|
||||
vec3 viewDirection;
|
||||
};
|
||||
|
||||
Lighting brdf (PhongSurface s, LightInfo info) {
|
||||
Lighting result;
|
||||
float ndh = 0.0;
|
||||
// Get the half direction in world space
|
||||
vec3 halfDir = normalize(s.viewDirection + info.lightDir);
|
||||
float NdotH = max(0.0, dot(s.normal, halfDir));
|
||||
NdotH = pow(NdotH, max(1.0, s.glossiness * 128.0));
|
||||
|
||||
result.diffuse = info.radiance * max(0.0, dot(s.normal, info.lightDir));
|
||||
result.specular = info.radiance * NdotH;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
vec4 composePhongShading (Lighting lighting, PhongSurface s) {
|
||||
vec4 o = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
//diffuse is always calculated
|
||||
o.rgb = lighting.diffuse * s.diffuse;
|
||||
|
||||
#if USE_EMISSIVE
|
||||
o.rgb += s.emissive;
|
||||
#endif
|
||||
|
||||
#if USE_SPECULAR
|
||||
o.rgb += lighting.specular * s.specular;
|
||||
#endif
|
||||
|
||||
o.a = s.opacity;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
vec3 ambient(PhongSurface s, vec4 ambientColor) {
|
||||
return s.diffuse * ambientColor.rgb;
|
||||
}
|
||||
|
||||
vec4 CCPhongShading (in PhongSurface s) {
|
||||
Lighting result;
|
||||
CC_CALC_LIGHTS(s, result, brdf, ambient)
|
||||
|
||||
return composePhongShading(result, s);
|
||||
}
|
||||
|
||||
#include <cc-lights>
|
||||
|
||||
struct PhongSurface {
|
||||
vec3 diffuse;
|
||||
vec3 emissive;
|
||||
vec3 specular;
|
||||
float opacity;
|
||||
|
||||
float glossiness;
|
||||
|
||||
vec3 position;
|
||||
vec3 normal;
|
||||
vec3 viewDirection;
|
||||
};
|
||||
|
||||
Lighting brdf (PhongSurface s, LightInfo info) {
|
||||
Lighting result;
|
||||
float ndh = 0.0;
|
||||
// Get the half direction in world space
|
||||
vec3 halfDir = normalize(s.viewDirection + info.lightDir);
|
||||
float NdotH = max(0.0, dot(s.normal, halfDir));
|
||||
NdotH = pow(NdotH, max(1.0, s.glossiness * 128.0));
|
||||
|
||||
result.diffuse = info.radiance * max(0.0, dot(s.normal, info.lightDir));
|
||||
result.specular = info.radiance * NdotH;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
vec4 composePhongShading (Lighting lighting, PhongSurface s) {
|
||||
vec4 o = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
//diffuse is always calculated
|
||||
o.rgb = lighting.diffuse * s.diffuse;
|
||||
|
||||
#if USE_EMISSIVE
|
||||
o.rgb += s.emissive;
|
||||
#endif
|
||||
|
||||
#if USE_SPECULAR
|
||||
o.rgb += lighting.specular * s.specular;
|
||||
#endif
|
||||
|
||||
o.a = s.opacity;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
vec3 ambient(PhongSurface s, vec4 ambientColor) {
|
||||
return s.diffuse * ambientColor.rgb;
|
||||
}
|
||||
|
||||
vec4 CCPhongShading (in PhongSurface s) {
|
||||
Lighting result;
|
||||
CC_CALC_LIGHTS(s, result, brdf, ambient)
|
||||
|
||||
return composePhongShading(result, s);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "1a52499e-8f48-484a-abe8-e298002f4579",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "1a52499e-8f48-484a-abe8-e298002f4579",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,72 +1,72 @@
|
||||
// Copyright (c) 2017-2019 Xiamen Yaji Software Co., Ltd.
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <cc-lights>
|
||||
|
||||
struct ToonSurface {
|
||||
vec4 baseColor;
|
||||
// specular
|
||||
vec3 specular;
|
||||
float specularThreshold;
|
||||
// these need to be in the same coordinate system
|
||||
vec3 position;
|
||||
vec3 normal;
|
||||
vec3 viewDirection;
|
||||
// emissive
|
||||
vec3 emissive;
|
||||
// shadow
|
||||
vec3 shadowColor;
|
||||
float shadowIntensity;
|
||||
vec3 highlightColor;
|
||||
// light
|
||||
float lightThreshold;
|
||||
float lightSmoothness;
|
||||
};
|
||||
|
||||
const float T_H = 0.25;
|
||||
float TreshHoldLighting(float lThreshold, float smoothness, float v) {
|
||||
return smoothstep(lThreshold-smoothness*T_H, lThreshold+smoothness*T_H, v);
|
||||
}
|
||||
|
||||
Lighting toon (ToonSurface s, LightInfo info) {
|
||||
Lighting result;
|
||||
|
||||
vec3 N = s.normal;
|
||||
vec3 L = info.lightDir;
|
||||
vec3 V = s.viewDirection;
|
||||
vec3 H = normalize(L + V);
|
||||
float NL = 0.5 * dot(N, L) + 0.5;
|
||||
float NH = 0.5 * dot(H, N) + 0.5;
|
||||
|
||||
vec3 c = vec3(0.0);
|
||||
|
||||
vec3 attenuation = info.radiance;
|
||||
vec3 lightColor = info.lightColor.rgb;
|
||||
|
||||
// diffuse
|
||||
vec3 shadowColor = mix(s.highlightColor * lightColor, s.shadowColor, s.shadowIntensity);
|
||||
vec3 diffuse = TreshHoldLighting(s.lightThreshold, s.lightSmoothness, NL) * attenuation;
|
||||
diffuse = mix(shadowColor, s.highlightColor * lightColor, diffuse);
|
||||
|
||||
result.diffuse = diffuse * s.baseColor.rgb;
|
||||
|
||||
// specular
|
||||
float specularWeight = 1.0 - pow(s.specularThreshold, 5.0);
|
||||
float specularMask = step(specularWeight, NH);
|
||||
vec3 specular = s.specular.rgb * specularMask;
|
||||
|
||||
result.specular = specular * attenuation;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
vec3 ambient(ToonSurface s, vec4 ambientColor) {
|
||||
return s.baseColor.rgb * ambientColor.rgb;
|
||||
}
|
||||
|
||||
vec4 CCToonShading (ToonSurface s) {
|
||||
Lighting result;
|
||||
CC_CALC_LIGHTS(s, result, toon, ambient)
|
||||
|
||||
vec3 finalColor = result.diffuse + result.specular + s.emissive;
|
||||
return vec4(finalColor, s.baseColor.a);
|
||||
}
|
||||
// Copyright (c) 2017-2019 Xiamen Yaji Software Co., Ltd.
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <cc-lights>
|
||||
|
||||
struct ToonSurface {
|
||||
vec4 baseColor;
|
||||
// specular
|
||||
vec3 specular;
|
||||
float specularThreshold;
|
||||
// these need to be in the same coordinate system
|
||||
vec3 position;
|
||||
vec3 normal;
|
||||
vec3 viewDirection;
|
||||
// emissive
|
||||
vec3 emissive;
|
||||
// shadow
|
||||
vec3 shadowColor;
|
||||
float shadowIntensity;
|
||||
vec3 highlightColor;
|
||||
// light
|
||||
float lightThreshold;
|
||||
float lightSmoothness;
|
||||
};
|
||||
|
||||
const float T_H = 0.25;
|
||||
float TreshHoldLighting(float lThreshold, float smoothness, float v) {
|
||||
return smoothstep(lThreshold-smoothness*T_H, lThreshold+smoothness*T_H, v);
|
||||
}
|
||||
|
||||
Lighting toon (ToonSurface s, LightInfo info) {
|
||||
Lighting result;
|
||||
|
||||
vec3 N = s.normal;
|
||||
vec3 L = info.lightDir;
|
||||
vec3 V = s.viewDirection;
|
||||
vec3 H = normalize(L + V);
|
||||
float NL = 0.5 * dot(N, L) + 0.5;
|
||||
float NH = 0.5 * dot(H, N) + 0.5;
|
||||
|
||||
vec3 c = vec3(0.0);
|
||||
|
||||
vec3 attenuation = info.radiance;
|
||||
vec3 lightColor = info.lightColor.rgb;
|
||||
|
||||
// diffuse
|
||||
vec3 shadowColor = mix(s.highlightColor * lightColor, s.shadowColor, s.shadowIntensity);
|
||||
vec3 diffuse = TreshHoldLighting(s.lightThreshold, s.lightSmoothness, NL) * attenuation;
|
||||
diffuse = mix(shadowColor, s.highlightColor * lightColor, diffuse);
|
||||
|
||||
result.diffuse = diffuse * s.baseColor.rgb;
|
||||
|
||||
// specular
|
||||
float specularWeight = 1.0 - pow(s.specularThreshold, 5.0);
|
||||
float specularMask = step(specularWeight, NH);
|
||||
vec3 specular = s.specular.rgb * specularMask;
|
||||
|
||||
result.specular = specular * attenuation;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
vec3 ambient(ToonSurface s, vec4 ambientColor) {
|
||||
return s.baseColor.rgb * ambientColor.rgb;
|
||||
}
|
||||
|
||||
vec4 CCToonShading (ToonSurface s) {
|
||||
Lighting result;
|
||||
CC_CALC_LIGHTS(s, result, toon, ambient)
|
||||
|
||||
vec3 finalColor = result.diffuse + result.specular + s.emissive;
|
||||
return vec4(finalColor, s.baseColor.a);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "d9205f02-3cd6-4822-9dba-7a9d05951265",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "d9205f02-3cd6-4822-9dba-7a9d05951265",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
#include <common/color/gamma>
|
||||
|
||||
#pragma define CCTexture(_texture_, _uv_, _color_) \
|
||||
vec4 _texture_##_tmp = texture(_texture_, _uv_); \
|
||||
#if CC_USE_EMBEDDED_ALPHA \
|
||||
_texture_##_tmp.a *= texture(_texture_, _uv_ + vec2(0, 0.5)).r; \
|
||||
#endif \
|
||||
#if INPUT_IS_GAMMA \
|
||||
_color_.rgb *= SRGBToLinear(_texture_##_tmp.rgb); \
|
||||
_color_.a *= _texture_##_tmp.a; \
|
||||
#else \
|
||||
_color_ *= _texture_##_tmp; \
|
||||
#endif \
|
||||
#pragma // empty pragma trick to get rid of trailing semicolons at effect compile time
|
||||
|
||||
#pragma define CCTextureRGB(_texture_, _uv_, _color_) \
|
||||
vec4 _texture_##_tmp = texture(_texture_, _uv_); \
|
||||
#if CC_USE_EMBEDDED_ALPHA \
|
||||
_texture_##_tmp.a *= texture(_texture_, _uv_ + vec2(0, 0.5)).r; \
|
||||
#endif \
|
||||
#if INPUT_IS_GAMMA \
|
||||
_color_.rgb *= SRGBToLinear(_texture_##_tmp.rgb); \
|
||||
#else \
|
||||
_color_.rgb *= _texture_##_tmp.rgb; \
|
||||
#endif \
|
||||
#pragma // empty pragma trick to get rid of trailing semicolons at effect compile time
|
||||
#include <common/color/gamma>
|
||||
|
||||
#pragma define CCTexture(_texture_, _uv_, _color_) \
|
||||
vec4 _texture_##_tmp = texture(_texture_, _uv_); \
|
||||
#if CC_USE_EMBEDDED_ALPHA \
|
||||
_texture_##_tmp.a *= texture(_texture_, _uv_ + vec2(0, 0.5)).r; \
|
||||
#endif \
|
||||
#if INPUT_IS_GAMMA \
|
||||
_color_.rgb *= SRGBToLinear(_texture_##_tmp.rgb); \
|
||||
_color_.a *= _texture_##_tmp.a; \
|
||||
#else \
|
||||
_color_ *= _texture_##_tmp; \
|
||||
#endif \
|
||||
#pragma // empty pragma trick to get rid of trailing semicolons at effect compile time
|
||||
|
||||
#pragma define CCTextureRGB(_texture_, _uv_, _color_) \
|
||||
vec4 _texture_##_tmp = texture(_texture_, _uv_); \
|
||||
#if CC_USE_EMBEDDED_ALPHA \
|
||||
_texture_##_tmp.a *= texture(_texture_, _uv_ + vec2(0, 0.5)).r; \
|
||||
#endif \
|
||||
#if INPUT_IS_GAMMA \
|
||||
_color_.rgb *= SRGBToLinear(_texture_##_tmp.rgb); \
|
||||
#else \
|
||||
_color_.rgb *= _texture_##_tmp.rgb; \
|
||||
#endif \
|
||||
#pragma // empty pragma trick to get rid of trailing semicolons at effect compile time
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "cfa00e18-26f8-43a1-934f-3e436f8954cd",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "cfa00e18-26f8-43a1-934f-3e436f8954cd",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <builtin/internal/alpha-test>
|
||||
#include <texture>
|
||||
#include <legacy/output>
|
||||
|
||||
uniform UNLIT {
|
||||
lowp vec4 diffuseColor;
|
||||
};
|
||||
|
||||
#if USE_DIFFUSE_TEXTURE
|
||||
uniform sampler2D diffuseTexture;
|
||||
#endif
|
||||
|
||||
#pragma define CC_USE_TEXTURE CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
in lowp vec4 v_color;
|
||||
#endif
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
in mediump vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
vec4 color = diffuseColor;
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
CCTexture(diffuseTexture, v_uv0, color);
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
color *= v_color;
|
||||
#endif
|
||||
|
||||
ALPHA_TEST(color);
|
||||
|
||||
gl_FragColor = CCFragOutput(color);
|
||||
}
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <builtin/internal/alpha-test>
|
||||
#include <texture>
|
||||
#include <legacy/output>
|
||||
|
||||
uniform UNLIT {
|
||||
lowp vec4 diffuseColor;
|
||||
};
|
||||
|
||||
#if USE_DIFFUSE_TEXTURE
|
||||
uniform sampler2D diffuseTexture;
|
||||
#endif
|
||||
|
||||
#pragma define CC_USE_TEXTURE CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
in lowp vec4 v_color;
|
||||
#endif
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
in mediump vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
vec4 color = diffuseColor;
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
CCTexture(diffuseTexture, v_uv0, color);
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
color *= v_color;
|
||||
#endif
|
||||
|
||||
ALPHA_TEST(color);
|
||||
|
||||
gl_FragColor = CCFragOutput(color);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "b1d8a244-d202-4645-a97a-694743a043fb",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "b1d8a244-d202-4645-a97a-694743a043fb",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <builtin/uniforms/cc-local>
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <legacy/input-standard>
|
||||
#include <legacy/skinning>
|
||||
|
||||
#pragma define CC_USE_TEXTURE CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE
|
||||
|
||||
uniform MAIN_TILING {
|
||||
vec2 mainTiling;
|
||||
vec2 mainOffset;
|
||||
};
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
out mediump vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
out lowp vec4 v_color;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
StandardVertInput In;
|
||||
CCVertInput(In);
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
v_color = In.color;
|
||||
#endif
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
v_uv0 = In.uv * mainTiling + mainOffset;
|
||||
#endif
|
||||
|
||||
gl_Position = cc_matViewProj * cc_matWorld * In.position;
|
||||
}
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <builtin/uniforms/cc-local>
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <legacy/input-standard>
|
||||
#include <legacy/skinning>
|
||||
|
||||
#pragma define CC_USE_TEXTURE CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE
|
||||
|
||||
uniform MAIN_TILING {
|
||||
vec2 mainTiling;
|
||||
vec2 mainOffset;
|
||||
};
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
out mediump vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
out lowp vec4 v_color;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
StandardVertInput In;
|
||||
CCVertInput(In);
|
||||
|
||||
#if CC_USE_ATTRIBUTE_COLOR
|
||||
v_color = In.color;
|
||||
#endif
|
||||
|
||||
#if CC_USE_TEXTURE
|
||||
v_uv0 = In.uv * mainTiling + mainOffset;
|
||||
#endif
|
||||
|
||||
gl_Position = cc_matViewProj * cc_matWorld * In.position;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "56d1607d-db90-4540-9685-ed7d9a5ca463",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "56d1607d-db90-4540-9685-ed7d9a5ca463",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
vec3 unpackNormal(vec4 nmap) {
|
||||
return nmap.xyz * 2.0 - 1.0;
|
||||
}
|
||||
|
||||
vec3 unpackRGBE(vec4 rgbe) {
|
||||
return rgbe.rgb * pow(2.0, rgbe.a * 255.0 - 128.0);
|
||||
}
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
vec3 unpackNormal(vec4 nmap) {
|
||||
return nmap.xyz * 2.0 - 1.0;
|
||||
}
|
||||
|
||||
vec3 unpackRGBE(vec4 rgbe) {
|
||||
return rgbe.rgb * pow(2.0, rgbe.a * 255.0 - 128.0);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "8dbf686e-8bae-48ea-89ee-5b0b6cc7888b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
{
|
||||
"ver": "1.0.7",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "8dbf686e-8bae-48ea-89ee-5b0b6cc7888b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user