提交 2be03c31 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #10177 from polygontwist/patch-3

add support for Lightimport in VRML (to DEV)
......@@ -416,6 +416,8 @@ THREE.VRMLLoader.prototype = {
break;
+ case 'location':
+ case 'direction':
case 'translation':
case 'scale':
case 'size':
......@@ -434,6 +436,8 @@ THREE.VRMLLoader.prototype = {
break;
case 'intensity':
case 'cutOffAngle':
case 'radius':
case 'topRadius':
case 'bottomRadius':
......@@ -469,6 +473,7 @@ THREE.VRMLLoader.prototype = {
break;
case 'on':
case 'ccw':
case 'solid':
case 'colorPerVertex':
......@@ -623,6 +628,85 @@ THREE.VRMLLoader.prototype = {
var object = parent;
if(data.string.indexOf("AmbientLight")>-1 && data.nodeType=='PointLight'){
//wenn im Namen "AmbientLight" vorkommt und es ein PointLight ist,
//diesen Typ in 'AmbientLight' ändern
data.nodeType='AmbientLight';
}
l_visible=data.on;
if(l_visible==undefined)l_visible=true;
l_intensity=data.intensity;
if(l_intensity==undefined)l_intensity=true;
if(data.color!=undefined)
l_color= new THREE.Color(data.color.r, data.color.g,data.color.b );
else
l_color= new THREE.Color(0, 0,0);
if('AmbientLight' === data.nodeType){
object=new THREE.AmbientLight(
l_color.getHex(),
l_intensity
);
object.visible=l_visible;
parent.add( object );
}
else
if('PointLight' === data.nodeType){
l_distance =0; //0="unendlich" ...1000
l_decay=0; //-1.. ?
if(data.radius!=undefined && data.radius<1000){
//l_radius=data.radius;
l_distance=data.radius;
l_decay=1;
}
object=new THREE.PointLight(
l_color.getHex(),
l_intensity,
l_distance);
object.visible=l_visible;
parent.add( object );
}
else
if('SpotLight' === data.nodeType){
l_intensity=1;
l_distance =0;//0="unendlich"=1000
l_angle=Math.PI/3;
l_penumbra=0.0;//0..1
l_decay=0;//-1.. ?
l_visible=true;
if(data.radius!=undefined && data.radius<1000){
//l_radius=data.radius;
l_distance=data.radius;
l_decay=1;
}
if(data.cutOffAngle!=undefined)l_angle=data.cutOffAngle;
object = new THREE.SpotLight(
l_color.getHex(),
l_intensity,
l_distance,
l_angle,
l_penumbra,
l_decay
);
object.visible=l_visible;
parent.add( object );
/*
var lightHelper = new THREE.SpotLightHelper( object );
parent.parent.add( lightHelper );
lightHelper.update();
*/
}
else
if ( 'Transform' === data.nodeType || 'Group' === data.nodeType ) {
object = new THREE.Object3D();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册