jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/365660 )
Change subject: Change the rendering materials
......................................................................
Change the rendering materials
* Lighting now includes a directional light
* Lighting overall reduced significantly
* Color changed
* Background color changed
Bug: T167748
Change-Id: I4a5794ca037e3d86405c3cdcd0a3d02232818ad7
---
M modules/mmv.3d.js
1 file changed, 15 insertions(+), 3 deletions(-)
Approvals:
Matthias Mullie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/mmv.3d.js b/modules/mmv.3d.js
index 6a891f6..0a9a1da 100644
--- a/modules/mmv.3d.js
+++ b/modules/mmv.3d.js
@@ -31,7 +31,11 @@
TD.createScene = function () {
var threed = this,
dimensions = this.dimensionsFunc(),
- ambient = new THREE.AmbientLight( 0x999999 );
+ ambient = new THREE.AmbientLight( 0x666666 ),
+ dlight = new THREE.DirectionalLight( 0x999999 );
+
+ dlight.position.set( 0, 0, 1 );
+ dlight.castShadow = true;
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera( 60,
dimensions.ratio, 1, 5000 );
@@ -41,9 +45,12 @@
this.camera.add( new THREE.PointLight( 0xffffff, 0.4 ) );
this.scene.add( ambient );
+ this.scene.add( dlight );
this.scene.add( this.camera );
this.renderer = new THREE.WebGLRenderer();
+
+ this.renderer.setClearColor( 0x222222 );
this.controls = new THREE.OrbitControls( this.camera,
this.renderer.domElement );
this.controls.addEventListener( 'change', $.proxy( function ()
{ threed.render(); }, threed ) );
@@ -80,9 +87,12 @@
};
TD.geometryToObject = function ( geometry ) {
- var material = new THREE.MeshPhongMaterial( { color: 0xaaaaff,
shading: THREE.FlatShading } );
+ var materials = [
+ new THREE.MeshPhongMaterial( { color: 0xF8F9FA,
shading: THREE.FlatShading } ),
+ new THREE.MeshBasicMaterial( { color: 0xC8CCD1,
shading: THREE.FlatShading, wireframe: true, transparent: true } )
+ ];
- return new THREE.Mesh( geometry, material );
+ return THREE.SceneUtils.createMultiMaterialObject( geometry,
materials );
};
TD.loadFile = function ( extension, url ) {
@@ -102,6 +112,8 @@
object = threed.geometryToObject( data );
}
+ object.castShadow = true;
+
threed.center( object );
threed.scene.add( object );
--
To view, visit https://gerrit.wikimedia.org/r/365660
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4a5794ca037e3d86405c3cdcd0a3d02232818ad7
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/3D
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits