mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 03:22:39 +08:00
57 lines
1.2 KiB
Plaintext
57 lines
1.2 KiB
Plaintext
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
|
|
|
CCEffect %{
|
|
techniques:
|
|
- passes:
|
|
- vert: planar-shadow-vs:vert
|
|
frag: planar-shadow-fs:frag
|
|
phase: planarShadow
|
|
depthStencilState:
|
|
depthTest: true
|
|
depthWrite: false
|
|
stencilTestFront: true
|
|
stencilFuncFront: not_equal
|
|
stencilPassOpFront: replace
|
|
stencilRef: 0x80 # only use the leftmost bit
|
|
stencilReadMask: 0x80
|
|
stencilWriteMask: 0x80
|
|
blendState:
|
|
targets:
|
|
- blend: true
|
|
blendSrc: src_alpha
|
|
blendDst: one_minus_src_alpha
|
|
blendDstAlpha: one_minus_src_alpha
|
|
}%
|
|
|
|
CCProgram planar-shadow-vs %{
|
|
precision highp float;
|
|
#include <input>
|
|
#include <cc-global>
|
|
#include <cc-local-batch>
|
|
#include <cc-shadow>
|
|
#include <cc-forward-light>
|
|
|
|
vec4 vert () {
|
|
vec4 position;
|
|
CCVertInput(position);
|
|
|
|
mat4 matWorld;
|
|
CCGetWorldMatrix(matWorld);
|
|
|
|
position = cc_matProj * (cc_matView * cc_matLightPlaneProj * matWorld) * position;
|
|
position.z -= 0.0001;
|
|
|
|
return position;
|
|
}
|
|
}%
|
|
|
|
CCProgram planar-shadow-fs %{
|
|
precision mediump float;
|
|
#include <cc-shadow>
|
|
#include <output>
|
|
|
|
vec4 frag () {
|
|
return CCFragOutput(cc_shadowColor);
|
|
}
|
|
}%
|