Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
akjava committed Jan 18, 2017
1 parent cb5fea4 commit 8f7956e
Show file tree
Hide file tree
Showing 4 changed files with 40,110 additions and 5 deletions.
@@ -1,5 +1,7 @@
package com.akjava.gwt.threejsexamples.client.examples.sweethome;

import java.util.List;

import com.akjava.gwt.html5.client.pointerlock.PointerLock;
import com.akjava.gwt.html5.client.pointerlock.PointerLock.PointerLockListener;
import com.akjava.gwt.lib.client.LogUtils;
Expand All @@ -8,7 +10,6 @@
import com.akjava.gwt.three.client.examples.js.controls.PointerLockControls;
import com.akjava.gwt.three.client.gwt.GWTParamUtils;
import com.akjava.gwt.three.client.gwt.core.Intersect;
import com.akjava.gwt.three.client.java.ThreeLog;
import com.akjava.gwt.three.client.java.ui.example.AbstractExample;
import com.akjava.gwt.three.client.java.utils.GWTThreeUtils;
import com.akjava.gwt.three.client.js.THREE;
Expand All @@ -19,7 +20,6 @@
import com.akjava.gwt.three.client.js.core.Object3D;
import com.akjava.gwt.three.client.js.core.Raycaster;
import com.akjava.gwt.three.client.js.extras.geometries.PlaneBufferGeometry;
import com.akjava.gwt.three.client.js.extras.helpers.BoxHelper;
import com.akjava.gwt.three.client.js.extras.helpers.PointLightHelper;
import com.akjava.gwt.three.client.js.extras.helpers.SpotLightHelper;
import com.akjava.gwt.three.client.js.lights.AmbientLight;
Expand All @@ -32,7 +32,7 @@
import com.akjava.gwt.three.client.js.objects.Mesh;
import com.akjava.gwt.three.client.js.renderers.WebGLRenderer;
import com.akjava.gwt.three.client.js.scenes.Scene;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.common.collect.Lists;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.KeyDownEvent;
Expand Down Expand Up @@ -314,7 +314,7 @@ public void loaded(Geometry geometry, JsArray<Material> materials) {

ObjectLoader loader = THREE.ObjectLoader();//var loader = new THREE.ObjectLoader();

loader.load( "sweethome/userguideexample.json",new ObjectLoadHandler() {
loader.load( "sweethome/userguideexamplefixed.json?t="+System.currentTimeMillis(),new ObjectLoadHandler() {



Expand All @@ -333,15 +333,23 @@ public void onLoad(Object3D object) {
dlight.getPosition().set(-1, 1, 1).normalize();

JsArray<Object3D> objects=scene.getChildren();

List<String> needDoubleSides=Lists.newArrayList("461","147","454");

for(int i=0;i<objects.length();i++){
Object3D obj=objects.get(i);
String name=obj.getName();
if(obj.getName().endsWith("628") || obj.getName().endsWith("634") || obj.getName().endsWith("622")|| obj.getName().endsWith("640")
|| obj.getName().endsWith("527") //kitchen
|| obj.getName().endsWith("612") //bus
){
Mesh mesh=obj.cast();
addLight(mesh);
//mesh.setVisible(false);
}else if(endsWith(needDoubleSides,name)){
Mesh mesh=obj.cast();
MeshPhongMaterial material=mesh.getMaterial().cast();
material.setSide(THREE.DoubleSide);
}
}

Expand All @@ -359,6 +367,14 @@ public void onLoad(Object3D object) {

} );
}
private boolean endsWith(List<String> names,String name){
for(String need:names){
if(name.endsWith(need)){
return true;
}
}
return false;
}
private SpotLightHelper lightHelper;

private int cameraY=150;
Expand All @@ -377,7 +393,11 @@ private void addLight(Mesh mesh){
scene.add( pointLight );

PointLightHelper pheloper=THREE.PointLightHelper(pointLight, 5);
scene.add(pheloper);
//scene.add(pheloper);

MeshPhongMaterial material=mesh.getMaterial().cast();
material.getColor().set(0x888888);
material.getEmissive().set(0xcc8c8c8);//shinning

}

Expand Down

0 comments on commit 8f7956e

Please sign in to comment.