提交 968e0e79 编写于 作者: W WestLangley 提交者: Mr.doob

Added alphaTest support (#8629)

上级 df5d55f5
......@@ -2,10 +2,16 @@
* @author mrdoob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
* @author bhouston / https://clara.io
* @author WestLangley / http://github.com/WestLangley
*
* parameters = {
*
* opacity: <float>,
*
* map: new THREE.Texture( <Image> ),
*
* alphaMap: new THREE.Texture( <Image> ),
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementScale: <float>,
* displacementBias: <float>,
......@@ -26,6 +32,10 @@ THREE.MeshDepthMaterial = function ( parameters ) {
this.skinning = false;
this.morphTargets = false;
this.map = null;
this.alphaMap = null;
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
......@@ -49,6 +59,10 @@ THREE.MeshDepthMaterial.prototype.copy = function ( source ) {
this.skinning = source.skinning;
this.morphTargets = source.morphTargets;
this.map = source.map;
this.alphaMap = source.alphaMap;
this.displacementMap = source.displacementMap;
this.displacementScale = source.displacementScale;
this.displacementBias = source.displacementBias;
......
......@@ -1890,7 +1890,8 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( material instanceof THREE.MeshBasicMaterial ||
material instanceof THREE.MeshLambertMaterial ||
material instanceof THREE.MeshPhongMaterial ||
material instanceof THREE.MeshStandardMaterial ) {
material instanceof THREE.MeshStandardMaterial ||
material instanceof THREE.MeshDepthMaterial ) {
refreshUniformsCommon( m_uniforms, material );
......@@ -1929,8 +1930,6 @@ THREE.WebGLRenderer = function ( parameters ) {
} else if ( material instanceof THREE.MeshDepthMaterial ) {
m_uniforms.opacity.value = material.opacity;
if ( material.displacementMap ) {
m_uniforms.displacementMap.value = material.displacementMap;
......
......@@ -171,11 +171,8 @@ THREE.ShaderLib = {
uniforms: THREE.UniformsUtils.merge( [
THREE.UniformsLib[ 'displacementmap' ],
{
"opacity" : { type: "1f", value: 1.0 }
}
THREE.UniformsLib[ 'common' ],
THREE.UniformsLib[ 'displacementmap' ]
] ),
......
......@@ -6,12 +6,28 @@
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <logdepthbuf_fragment>
#if DEPTH_PACKING == 3200
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册