|
@@ -11,6 +11,22 @@ class Main extends hxd.App {
|
|
s3d.camera.target.z += 0.5;
|
|
s3d.camera.target.z += 0.5;
|
|
|
|
|
|
obj.playAnimation(prim.loadAnimation(LinearAnim));
|
|
obj.playAnimation(prim.loadAnimation(LinearAnim));
|
|
|
|
+
|
|
|
|
+ // add lights
|
|
|
|
+ var dir = new DirLight(new h3d.Vector( 2, 3, -5), s3d);
|
|
|
|
+ for( s in obj )
|
|
|
|
+ s.toMesh().material.mainPass.enableLights = true;
|
|
|
|
+ var ls = s3d.mainPass.lightSystem;
|
|
|
|
+ ls.ambientLight.set(0.4, 0.4, 0.4);
|
|
|
|
+ ls.perPixelLighting = true;
|
|
|
|
+
|
|
|
|
+ // add self shadowing
|
|
|
|
+ for( s in obj )
|
|
|
|
+ s.toMesh().material.shadows = true;
|
|
|
|
+
|
|
|
|
+ var shadow = cast(s3d.getPass("shadow"), h3d.pass.ShadowMap);
|
|
|
|
+ shadow.lightDirection = dir.direction;
|
|
|
|
+ shadow.power = 50;
|
|
}
|
|
}
|
|
|
|
|
|
function loadTexture( name : String, _ ) {
|
|
function loadTexture( name : String, _ ) {
|