MarkTraceur has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/365661 )
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: I211920c91ca4a78c2d80885da88031087cdb6ae5
---
M 3d2png.js
1 file changed, 14 insertions(+), 4 deletions(-)
Approvals:
MarkTraceur: Verified; Looks good to me, approved
Matthias Mullie: Looks good to me, but someone else must approve
diff --git a/3d2png.js b/3d2png.js
index 62941aa..da29b88 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -28,15 +28,20 @@
* Sets up the Three environment (ambient light, camera, renderer)
*/
ThreeDtoPNG.prototype.setupEnvironment = function() {
- var ambient = new THREE.AmbientLight( 0x999999 ),
+ var ambient = new THREE.AmbientLight( 0x666666 ),
+ dlight = new THREE.DirectionalLight( 0x999999 ),
point = new THREE.PointLight( 0xffffff, 0.4 );
- this.scene.add( ambient );
+ dlight.position.set( 0, 0, 1 );
+ dlight.castShadow = true;
+ this.scene.add( ambient );
+ this.scene.add( dlight );
this.camera.add( point );
this.scene.add( this.camera );
this.renderer.setSize( this.width, this.height, false );
+ this.renderer.setClearColor( 0x222222 );
};
/**
@@ -45,8 +50,11 @@
* @returns {THREE.Mesh} mesh
*/
ThreeDtoPNG.prototype.outputToObject = function ( geometry ) {
- var material = new THREE.MeshPhongMaterial( { color: 0xaaaaff, shading:
THREE.FlatShading } ),
- mesh = new THREE.Mesh( geometry, material );
+ var materials = [
+ new THREE.MeshPhongMaterial( { color: 0xF8F9FA,
shading: THREE.FlatShading } ),
+ new THREE.MeshBasicMaterial( { color: 0xC8CCD1,
shading: THREE.FlatShading, wireframe: true, transparent: true } )
+ ],
+ mesh = new THREE.SceneUtils.createMultiMaterialObject(
geometry, materials );
return mesh;
};
@@ -103,6 +111,8 @@
// Convert what the loader returns into an object we can add to the
scene
object = this.outputToObject( output );
+ object.castShadow = true;
+
// Position the camera relative to the object
// This allows us to look at the object from enough distance and from
// an angle
--
To view, visit https://gerrit.wikimedia.org/r/365661
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I211920c91ca4a78c2d80885da88031087cdb6ae5
Gerrit-PatchSet: 3
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits