提交 8582c743 编写于 作者: M Mr.doob

Revert "GLTFLoader: Simplified alphaMode handling."

This reverts commit 15947a3a.
上级 4361a31b
......@@ -2092,7 +2092,7 @@ THREE.GLTFLoader = ( function () {
}
var alphaMode = materialDef.alphaMode;
var alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;
if ( alphaMode === ALPHA_MODES.BLEND ) {
......@@ -2101,9 +2101,21 @@ THREE.GLTFLoader = ( function () {
// See: https://github.com/mrdoob/three.js/issues/17706
materialParams.depthWrite = false;
} else if ( alphaMode === ALPHA_MODES.MASK ) {
} else {
materialParams.transparent = false;
if ( alphaMode === ALPHA_MODES.MASK ) {
materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
} else {
// for ALPHA_MODES.OPAQUE, we use a negative alphaTest value to enable alphaTesting,
// causing the test to always be passed, but also replacing any alpha value with 1.0.
materialParams.alphaTest = - 0.5;
}
}
......
......@@ -2155,7 +2155,7 @@ var GLTFLoader = ( function () {
}
var alphaMode = materialDef.alphaMode;
var alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;
if ( alphaMode === ALPHA_MODES.BLEND ) {
......@@ -2164,9 +2164,21 @@ var GLTFLoader = ( function () {
// See: https://github.com/mrdoob/three.js/issues/17706
materialParams.depthWrite = false;
} else if ( alphaMode === ALPHA_MODES.MASK ) {
} else {
materialParams.transparent = false;
if ( alphaMode === ALPHA_MODES.MASK ) {
materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
} else {
// for ALPHA_MODES.OPAQUE, we use a negative alphaTest value to enable alphaTesting,
// causing the test to always be passed, but also replacing any alpha value with 1.0.
materialParams.alphaTest = - 0.5;
}
}
......
......@@ -5,11 +5,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="main.css">
<style>
body {
background-color: white;
}
</style>
</head>
<body>
......@@ -19,7 +14,7 @@
<div id="description"></div>
</div>
<div id="container"></div>
<div id="container" style="background-color: white;"></div>
<script type="module">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册