|
@@ -4052,45 +4052,22 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
// Materials
|
|
// Materials
|
|
|
|
|
|
|
|
+ var shaderIDs = {
|
|
|
|
+ MeshDepthMaterial: 'depth',
|
|
|
|
+ MeshNormalMaterial: 'normal',
|
|
|
|
+ MeshBasicMaterial: 'basic',
|
|
|
|
+ MeshLambertMaterial: 'lambert',
|
|
|
|
+ MeshPhongMaterial: 'phong',
|
|
|
|
+ LineBasicMaterial: 'basic',
|
|
|
|
+ LineDashedMaterial: 'dashed',
|
|
|
|
+ PointCloudMaterial: 'particle_basic'
|
|
|
|
+ };
|
|
|
|
+
|
|
function initMaterial( material, lights, fog, object ) {
|
|
function initMaterial( material, lights, fog, object ) {
|
|
|
|
|
|
material.addEventListener( 'dispose', onMaterialDispose );
|
|
material.addEventListener( 'dispose', onMaterialDispose );
|
|
|
|
|
|
- var shaderID;
|
|
|
|
-
|
|
|
|
- if ( material instanceof THREE.MeshDepthMaterial ) {
|
|
|
|
-
|
|
|
|
- shaderID = 'depth';
|
|
|
|
-
|
|
|
|
- } else if ( material instanceof THREE.MeshNormalMaterial ) {
|
|
|
|
-
|
|
|
|
- shaderID = 'normal';
|
|
|
|
-
|
|
|
|
- } else if ( material instanceof THREE.MeshBasicMaterial ) {
|
|
|
|
-
|
|
|
|
- shaderID = 'basic';
|
|
|
|
-
|
|
|
|
- } else if ( material instanceof THREE.MeshLambertMaterial ) {
|
|
|
|
-
|
|
|
|
- shaderID = 'lambert';
|
|
|
|
-
|
|
|
|
- } else if ( material instanceof THREE.MeshPhongMaterial ) {
|
|
|
|
-
|
|
|
|
- shaderID = 'phong';
|
|
|
|
-
|
|
|
|
- } else if ( material instanceof THREE.LineBasicMaterial ) {
|
|
|
|
-
|
|
|
|
- shaderID = 'basic';
|
|
|
|
-
|
|
|
|
- } else if ( material instanceof THREE.LineDashedMaterial ) {
|
|
|
|
-
|
|
|
|
- shaderID = 'dashed';
|
|
|
|
-
|
|
|
|
- } else if ( material instanceof THREE.PointCloudMaterial ) {
|
|
|
|
-
|
|
|
|
- shaderID = 'particle_basic';
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ var shaderID = shaderIDs[ material.type ];
|
|
|
|
|
|
if ( shaderID ) {
|
|
if ( shaderID ) {
|
|
|
|
|