Prechádzať zdrojové kódy

New demo: Worldmonger
Improved IE shaders

deltakosh 12 rokov pred
rodič
commit
84719f46e6

+ 14 - 6
Babylon/Materials/textures/babylon.baseTexture.js

@@ -60,17 +60,13 @@
         return null;
     };
 
-    BABYLON.BaseTexture.prototype.dispose = function () {
+    BABYLON.BaseTexture.prototype.releaseInternalTexture = function() {
         if (this._texture === undefined) {
             return;
         }
         var texturesCache = this._scene.getEngine().getLoadedTexturesCache();
         this._texture.references--;
-        
-        // Remove from scene
-        var index = this._scene.textures.indexOf(this);
-        this._scene.textures.splice(index, 1);
-        
+
         // Final reference ?
         if (this._texture.references == 0) {
             var index = texturesCache.indexOf(this._texture);
@@ -80,6 +76,18 @@
 
             delete this._texture;
         }
+    };
+
+    BABYLON.BaseTexture.prototype.dispose = function () {
+        if (this._texture === undefined) {
+            return;
+        }
+
+        this.releaseInternalTexture();
+        
+        // Remove from scene
+        var index = this._scene.textures.indexOf(this);
+        this._scene.textures.splice(index, 1);
         
         // Callback
         if (this.onDispose) {

+ 5 - 0
Babylon/Materials/textures/babylon.renderTargetTexture.js

@@ -20,6 +20,11 @@
     // Methods  
     BABYLON.RenderTargetTexture.prototype.onBeforeRender = null;
     BABYLON.RenderTargetTexture.prototype.onAfterRender = null;
+
+    BABYLON.RenderTargetTexture.prototype.resize = function(size, generateMipMaps) {
+        this.releaseInternalTexture();
+        this._texture = this._scene.getEngine().createRenderTargetTexture(size, generateMipMaps);
+    };
     
     BABYLON.RenderTargetTexture.prototype.render = function () {
         if (this.onBeforeRender) {

+ 3 - 3
Babylon/Shaders/default.fragment.fx

@@ -206,7 +206,7 @@ lightingInfo computeLighting(vec3 viewDirectionW, vec3 vNormal, vec4 lightData,
 
 	// Specular
 	vec3 angleW = normalize(viewDirectionW + lightVectorW);
-	float specComp = max(0., dot(normalize(vNormal), angleW));
+	float specComp = max(0., dot(vNormal, angleW));
 	specComp = pow(specComp, vSpecularColor.a);
 
 	result.diffuse = ndl * diffuseColor;
@@ -234,7 +234,7 @@ lightingInfo computeSpotLighting(vec3 viewDirectionW, vec3 vNormal, vec4 lightDa
 
 		// Specular
 		vec3 angleW = normalize(viewDirectionW - lightDirection.xyz);
-		float specComp = max(0., dot(normalize(vNormal), angleW));
+		float specComp = max(0., dot(vNormal, angleW));
 		specComp = pow(specComp, vSpecularColor.a);
 
 		result.diffuse = ndl * spotAtten * diffuseColor;
@@ -257,7 +257,7 @@ lightingInfo computeHemisphericLighting(vec3 viewDirectionW, vec3 vNormal, vec4
 
 	// Specular
 	vec3 angleW = normalize(viewDirectionW + lightData.xyz);
-	float specComp = max(0., dot(normalize(vNormal), angleW));
+	float specComp = max(0., dot(vNormal, angleW));
 	specComp = pow(specComp, vSpecularColor.a);
 
 	result.diffuse = mix(groundColor, diffuseColor, ndl);

+ 75 - 2
Babylon/Shaders/iedefault.fragment.fx

@@ -18,6 +18,12 @@ uniform vec3 vLightDiffuse0;
 uniform vec3 vLightSpecular0;
 #endif
 
+#ifdef LIGHT1
+uniform vec4 vLightData1;
+uniform vec3 vLightDiffuse1;
+uniform vec3 vLightSpecular1;
+#endif
+
 // Samplers
 #ifdef DIFFUSE
 varying vec2 vDiffuseUV;
@@ -64,6 +70,44 @@ varying vec3 vNormalW;
 varying float fClipDistance;
 #endif
 
+// Fog
+#ifdef FOG
+
+#define FOGMODE_NONE    0.
+#define FOGMODE_EXP     1.
+#define FOGMODE_EXP2    2.
+#define FOGMODE_LINEAR  3.
+#define E 2.71828
+
+uniform vec4 vFogInfos;
+uniform vec3 vFogColor;
+varying float fFogDistance;
+
+float CalcFogFactor()
+{
+	float fogCoeff = 1.0;
+	float fogStart = vFogInfos.y;
+	float fogEnd = vFogInfos.z;
+	float fogDensity = vFogInfos.w;
+
+	if (FOGMODE_LINEAR == vFogInfos.x)
+	{
+		fogCoeff = (fogEnd - fFogDistance) / (fogEnd - fogStart);
+	}
+	else if (FOGMODE_EXP == vFogInfos.x)
+	{
+		fogCoeff = 1.0 / pow(E, fFogDistance * fogDensity);
+	}
+	else if (FOGMODE_EXP2 == vFogInfos.x)
+	{
+		fogCoeff = 1.0 / pow(E, fFogDistance * fFogDistance * fogDensity * fogDensity);
+	}
+
+	return min(1., max(0., fogCoeff));
+}
+
+#endif
+
 void main(void) {
 	// Clip plane
 #ifdef CLIPPLANE
@@ -115,12 +159,34 @@ void main(void) {
 
 	// Specular
 	vec3 angleW = normalize(viewDirectionW + lightVectorW);
-	float specComp = dot(normalize(vNormalW), angleW);
+	float specComp = max(0., dot(vNormalW, angleW));
 	specComp = pow(specComp, vSpecularColor.a);
 
 	diffuseBase += ndl * vLightDiffuse0;
 	specularBase += specComp * vLightSpecular0;
 #endif
+#ifdef LIGHT1
+	if (vLightData1.w == 0.)
+	{
+		lightVectorW = normalize(vLightData1.xyz - vPositionW);
+	}
+	else
+	{
+		lightVectorW = normalize(-vLightData1.xyz);
+	}
+
+	// diffuse
+	ndl = max(0., dot(vNormalW, lightVectorW));
+
+	// Specular
+	angleW = normalize(viewDirectionW + lightVectorW);
+	specComp = max(0., dot(vNormalW, angleW));
+	specComp = pow(specComp, vSpecularColor.a);
+
+	diffuseBase += ndl * vLightDiffuse1;
+	specularBase += specComp * vLightSpecular1;
+#endif
+
 
 	// Reflection
 	vec3 reflectionColor = vec3(0., 0., 0.);
@@ -169,5 +235,12 @@ void main(void) {
 	vec3 finalDiffuse = clamp(diffuseBase * diffuseColor + emissiveColor + vAmbientColor, 0.0, 1.0) * baseColor.rgb;
 	vec3 finalSpecular = specularBase * specularColor;
 
-	gl_FragColor = vec4(finalDiffuse * baseAmbientColor + finalSpecular + reflectionColor, alpha);
+	vec4 color = vec4(finalDiffuse * baseAmbientColor + finalSpecular + reflectionColor, alpha);
+
+#ifdef FOG
+	float fog = CalcFogFactor();
+	color.rgb = fog * color.rgb + (1.0 - fog) * vFogColor;
+#endif
+
+	gl_FragColor = color;
 }

+ 20 - 6
Babylon/Shaders/iedefault.vertex.fx

@@ -3,6 +3,7 @@
 #define MAP_PLANAR		2.
 #define MAP_CUBIC		3.
 #define MAP_PROJECTION	4.
+#define MAP_SKYBOX		5.
 
 // Attributes
 attribute vec3 position;
@@ -16,6 +17,7 @@ attribute vec2 uv2;
 
 // Uniforms
 uniform mat4 world;
+uniform mat4 view;
 uniform mat4 worldViewProjection;
 
 #ifdef DIFFUSE
@@ -38,7 +40,6 @@ uniform vec2 vOpacityInfos;
 
 #ifdef REFLECTION
 uniform vec3 vEyePosition;
-uniform mat4 view;
 varying vec3 vReflectionUVW;
 
 uniform vec3 vReflectionInfos;
@@ -66,12 +67,16 @@ uniform vec4 vClipPlane;
 varying float fClipDistance;
 #endif
 
+#ifdef FOG
+varying float fFogDistance;
+#endif
+
 #ifdef REFLECTION
 vec3 computeReflectionCoords(float mode, vec4 worldPos, vec3 worldNormal)
-{	
+{
 	if (mode == MAP_SPHERICAL)
 	{
-		vec3 coords = vec3(view * vec4(worldNormal, 0.0));	
+		vec3 coords = vec3(view * vec4(worldNormal, 0.0));
 
 		return vec3(reflectionMatrix * vec4(coords, 1.0));
 	}
@@ -87,19 +92,23 @@ vec3 computeReflectionCoords(float mode, vec4 worldPos, vec3 worldNormal)
 		vec3 viewDir = worldPos.xyz - vEyePosition;
 		vec3 coords = reflect(viewDir, worldNormal);
 
-		return vec3(reflectionMatrix * vec4(coords, 0));	
+		return vec3(reflectionMatrix * vec4(coords, 0));
 	}
 	else if (mode == MAP_PROJECTION)
 	{
 		return vec3(reflectionMatrix * (view * worldPos));
 	}
+	else if (mode == MAP_SKYBOX)
+	{
+		return position;
+	}
 
 	return vec3(0, 0, 0);
 }
 #endif
 
 void main(void) {
-	gl_Position = worldViewProjection * vec4(position, 1.0);   
+	gl_Position = worldViewProjection * vec4(position, 1.0);
 
 	vec4 worldPos = world * vec4(position, 1.0);
 	vPositionW = vec3(worldPos);
@@ -174,6 +183,11 @@ void main(void) {
 
 	// Clip plane
 #ifdef CLIPPLANE
-		fClipDistance = dot(worldPos, vClipPlane);
+	fClipDistance = dot(worldPos, vClipPlane);
+#endif
+
+	// Fog
+#ifdef FOG
+	fFogDistance = (view * worldPos).z;
 #endif
 }

+ 2 - 2
Babylon/Tools/babylon.sceneLoader.js

@@ -321,7 +321,7 @@
     };
 
     BABYLON.SceneLoader = {
-        ImportMesh: function (meshName, rootUrl, sceneFilename, scene, then) {
+        ImportMesh: function (meshName, rootUrl, sceneFilename, scene, then, progressCallBack) {
             BABYLON.Tools.LoadFile(rootUrl + sceneFilename, function (data) {
                 var parsedData = JSON.parse(data);
 
@@ -377,7 +377,7 @@
                 if (then) {
                     then(meshes, particleSystems);
                 }
-            });
+            }, progressCallBack);
         },
         Load: function (rootUrl, sceneFilename, engine, then, progressCallBack) {
             BABYLON.Tools.LoadFile(rootUrl + sceneFilename, function (data) {

+ 4 - 0
Babylon/babylon.engine.js

@@ -99,6 +99,10 @@
         this._hardwareScalingLevel = level;
         this.resize();
     };
+    
+    BABYLON.Engine.prototype.getHardwareScalingLevel = function () {
+        return this._hardwareScalingLevel;
+    };
 
     BABYLON.Engine.prototype.getLoadedTexturesCache = function () {
         return this._loadedTexturesCache;

+ 10 - 7
Babylon/babylon.scene.js

@@ -51,6 +51,7 @@
         this.textures = [];
 
         // Particles
+        this.particlesEnabled = true;
         this.particleSystems = [];
 
         // Sprites
@@ -355,12 +356,14 @@
 
         // Particle systems
         var beforeParticlesDate = new Date();
-        for (var particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {
-            var particleSystem = this.particleSystems[particleIndex];
+        if (this.particlesEnabled) {
+            for (var particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {
+                var particleSystem = this.particleSystems[particleIndex];
 
-            if (!particleSystem.emitter.position || (particleSystem.emitter && particleSystem.emitter.isEnabled())) {
-                this._activeParticleSystems.push(particleSystem);
-                particleSystem.animate();
+                if (!particleSystem.emitter.position || (particleSystem.emitter && particleSystem.emitter.isEnabled())) {
+                    this._activeParticleSystems.push(particleSystem);
+                    particleSystem.animate();
+                }
             }
         }
         this._particlesDuration += new Date() - beforeParticlesDate;
@@ -414,7 +417,7 @@
         for (var particleIndex = 0; particleIndex < this._activeParticleSystems.length; particleIndex++) {
             var particleSystem = this._activeParticleSystems[particleIndex];
 
-            if (!activeMeshes || activeMeshes.indexOf(particleSystem.emitter) !== -1) {
+            if (!particleSystem.emitter.position || !activeMeshes || activeMeshes.indexOf(particleSystem.emitter) !== -1) {
                 this._activeParticles += particleSystem.render();
             }
         }
@@ -626,7 +629,7 @@
             this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix());
         }
 
-        return BABYLON.Ray.CreateNew(x, y, engine.getRenderWidth(), engine.getRenderHeight(), world ? world : BABYLON.Matrix.Identity(), this._viewMatrix, this._projectionMatrix);
+        return BABYLON.Ray.CreateNew(x, y, engine.getRenderWidth() * engine.getHardwareScalingLevel(), engine.getRenderHeight() * engine.getHardwareScalingLevel(), world ? world : BABYLON.Matrix.Identity(), this._viewMatrix, this._projectionMatrix);
     };
 
     BABYLON.Scene.prototype.pick = function (x, y) {

+ 1 - 1
Samples/Scenes/Customs/test.js

@@ -63,7 +63,7 @@
     mirror.material.reflectionTexture.renderList = [box, box2, box3, sphere];
     mirror.material.reflectionTexture.level = 0.5;
     mirror.position = new BABYLON.Vector3(0, -5.0, 0);
-
+    
     // Sprites
     var spriteManager = new BABYLON.SpriteManager("MonsterA", "Assets/Player.png", 500, 64, scene);
     for (var index = 0; index < 500; index++) {

BIN
Samples/Screenshots/Heart.jpg


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 4 - 4
Samples/babylon.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 1
Samples/hand.js


+ 35 - 9
Samples/index.css

@@ -468,24 +468,50 @@ button {
 
 #aboutPanel {
     position: absolute;
-    height: 100%;
-    width: 460px;
-    left: 0;
-    top: 0;
+    height: 80%;
+    width: 80%;
+    left: 10%;
+    top: 10%;
     z-index: 50;
     transition: transform 0.25s ease-in-out;
     background-color: #EEEEEE;
+    border: 2px solid #DDDDDD;
     color: #888888;
     padding-left: 20px;
     padding-right: 20px;
-    transform: translateX(-500px);
+    transform: translateX(-120%);
     -webkit-transition: -webkit-transform 0.25s ease-in-out;
-    -webkit-transform: translateX(-500px);
+    -webkit-transform: translateX(-120%);
 }
 
 #aboutParagraph {
-    position: absolute;
-    height: 100%;
-    width: 480px;
+    text-align: center;
+}
+
+#features {
     overflow-y: auto;
+    overflow-x: hidden;
+    position: absolute;
+    top: 320px;
+    left: 10px;
+    right: 10px;
+    bottom: 10px;
+}
+
+#engineFeatures {
+    column-count: 3;
+    column-gap: 20px;
+    column-rule-color: #ccc;
+    column-rule-style: dotted;
+    column-rule-width: 2px;
+    -webkit-column-count: 3;
+    -webkit-column-gap: 20px;
+    -webkit-column-rule-color: #ccc;
+    -webkit-column-rule-style: dotted;
+    -webkit-column-rule-width: 2px;
+    -moz-column-count: 3;
+    -moz-column-gap: 20px;
+    -moz-column-rule-color: #ccc;
+    -moz-column-rule-style: dotted;
+    -moz-column-rule-width: 2px;
 }

+ 100 - 78
Samples/index.html

@@ -15,7 +15,7 @@
 
     </script>
     <link href="index.css" rel="stylesheet" />
-    <script src="hand.js"></script>
+    <script src="hand.minified-1.1.0.js"></script>
     <!--<script src="Babylon/Tools/babylon.math.js"></script>
     <script src="Babylon/Tools/babylon.tools.js"></script>
     <script src="Babylon/babylon.engine.js"></script>
@@ -74,11 +74,11 @@
                 </div>
                 <div id="itemsContainer">
                     <div class="header">
-                       DEMOS     
+                        DEMOS
                     </div>
                     <div id="items"></div>
                     <div class="header">
-                        <br/>                        
+                        <br />
                         FEATURES TESTS
                     </div>
                     <div id="testItems"></div>
@@ -99,79 +99,101 @@
             </a>
             <div id="aboutText">ABOUT</div>
             <img id="aboutLink" src="Assets/BtnAbout.png" class="button" />
-        </div>
-        <div id="aboutPanel">
-            <div id="aboutParagraph">
-                <h1>Credits</h1>
-                <p>
-                    <i>3D engine:</i> David <b>CATUHE</b> (<a href="http://www.twitter.com/@deltakosh">@deltakosh</a>)<br />
-                    <i>Scenes:</i> Michel <b>ROUSSEAU</b> (<a href="http://www.twitter.com/@rousseau_michel">@rousseau_michel</a>)<br />
-                    <i>Game FX:</i> Pierre <b>LAGARDE</b> (<a href="http://www.twitter.com/@pierlag">@pierlag</a>)<br />
-                    <i>Game FX:</i> Sébastien <b>PERTUS</b> (<a href="http://www.twitter.com/@sebastienpertus">@sebastienpertus</a>)<br />
-                    <i>Game FX:</i> David <b>ROUSSET</b> (<a href="http://www.twitter.com/@davrous">@davrous</a>)<br />
-                </p>
-                <h1>About babylon.js</h1>
-                <p>
-                    Babylon.js is a <b>webgl</b> / <b>javascript</b> 3D engine.
+            <div id="aboutPanel">
+                <div id="aboutParagraph">
+                    <h1>Credits</h1>
+                    <p>
+                        <i>3D engine:</i> David <b>CATUHE</b> (<a href="http://www.twitter.com/@deltakosh">@deltakosh</a>)<br />
+                        <i>Scenes:</i> Michel <b>ROUSSEAU</b> (<a href="http://www.twitter.com/@rousseau_michel">@rousseau_michel</a>)<br />
+                        <i>Game FX:</i> Pierre <b>LAGARDE</b> (<a href="http://www.twitter.com/@pierlag">@pierlag</a>)<br />
+                        <i>Game FX:</i> Sébastien <b>PERTUS</b> (<a href="http://www.twitter.com/@sebastienpertus">@sebastienpertus</a>)<br />
+                        <i>Game FX:</i> David <b>ROUSSET</b> (<a href="http://www.twitter.com/@davrous">@davrous</a>)<br />
+                    </p>
+                </div>
+                <div id="aboutParagraph">
+                    <h1>About babylon.js</h1>
+                    Babylon.js is a 3D engine based on <b>webgl</b> and <b>javascript</b>.
                     It supports the following features:
-                    <ul>
-                        <li>Complete scene graph with lights, cameras, materials and meshes</li>
-                        <li>
-                            Standard material is a <b>per pixel</b> material that supports:
-                            <ul>
-                                <li>Diffuse lightning and texture</li>
-                                <li>Ambient lightning and texture</li>
-                                <li>Specular lightning</li>
-                                <li>Opacity texture</li>
-                                <li>Reflection texture (Spheric, planar, cubic and projection)</li>
-                                <li><b>Mirror texture</b></li>
-                                <li><b>Emissive texture</b></li>
-                                <li><b>Specular texture</b></li>
-                                <li><b>Bump texture</b></li>
-                                <li>Up to 4 lights (points, directionals, spots, hemispherics)</li>
-                            </ul>
-                        </li>
-                        <li>Render target textures</li>
-                        <li>Dynamic textures (canvas)</li>
-                        <li>Video textures</li>
-                        <li>Custom materials</li>
-                        <li>Alpha blending</li>
-                        <li>Alpha testing</li>
-                        <li>Billboarding</li>
-                        <li>Scene picking</li>
-                        <li><b>Collisions engine</b></li>
-                        <li>
-                            Cameras:
-                            <ul>
-                                <li>Arc rotate camera</li>
-                                <li>Free camera</li>
-                                <li><b>Touch camera</b></li>
-                            </ul>
-                        </li>
-                        <li>Frustum clipping</li>
-                        <li>Sub-meshes clipping</li>
-                        <li><b>Fullscreen mode</b></li>
-                        <li>
-                            Babylon file format is a JSON file that can be produced from:
-                            <ul>
-                                <li>.OBJ</li>
-                                <li>.FBX</li>
-                                <li>.MXB</li>
-                                <li>Blender</li>
-                            </ul>
-                        </li>
-                        <li>Hardware scaling</li>
-                        <li>Antialiasing</li>
-                        <li><b>Particles Systems</b></li>
-                        <li>Mesh cloning</li>
-                        <li><b>Animations engine</b></li>
-                        <li>Sprites and 2D layers</li>
-                        <li>Fog</li>
-                        <li>Skybox</li>
-                        <li>Dynamic meshes</li>
-                        <li>Height maps</li>
-                    </ul>
-                </p>
+                </div>
+                <div id="features">
+                    <div id="engineFeatures">
+                        <ul>
+                            <li>Complete scene graph with lights, cameras, materials and meshes</li>
+                            <li><b>Collisions engine</b></li>
+                            <li>Scene picking</li>
+                            <li>Antialiasing</li>
+                            <li><b>Animations engine</b></li>
+                            <li><b>Particles Systems</b></li>
+                            <li>Sprites and 2D layers</li>
+                            <li>
+                                Optimizations engines:
+                                <ul>
+                                    <li>Frustum clipping</li>
+                                    <li>Sub-meshes clipping</li>
+                                    <li>Hardware scaling</li>
+                                </ul>
+                            </li>
+                            <li>
+                                Standard material is a <b>per pixel</b> material that supports:
+                                <ul>
+                                    <li>Diffuse lightning and texture</li>
+                                    <li>Ambient lightning and texture</li>
+                                    <li>Specular lightning</li>
+                                    <li>Opacity texture</li>
+                                    <li>Reflection texture (Spheric, planar, cubic and projection)</li>
+                                    <li><b>Mirror texture</b></li>
+                                    <li><b>Emissive texture</b></li>
+                                    <li><b>Specular texture</b></li>
+                                    <li><b>Bump texture</b></li>
+                                    <li>Up to 4 lights (points, directionals, spots, hemispherics)</li>
+                                    <li>Custom materials</li>
+                                    <li>Skybox</li>
+                                </ul>
+                            </li>
+                            <li>
+                                Special FX
+                                <ul>
+                                    <li>Fog</li>
+                                    <li>Alpha blending</li>
+                                    <li>Alpha testing</li>
+                                    <li>Billboarding</li>
+                                    <li>Fullscreen mode</li>
+                                </ul>
+                            </li>
+                            <li>
+                                Textures:
+                                <ul>
+                                    <li>Render target textures</li>
+                                    <li>Dynamic textures (canvas)</li>
+                                    <li>Video textures</li>
+                                </ul>
+                            </li>
+                            <li>
+                                Cameras:
+                                <ul>
+                                    <li>Arc rotate camera</li>
+                                    <li>Free camera</li>
+                                    <li><b>Touch camera</b></li>
+                                </ul>
+                            </li>
+                            <li>
+                                Meshes:
+                                <ul>
+                                    <li>Mesh cloning</li>
+                                    <li>Dynamic meshes</li>
+                                    <li><b>Height maps</b></li>                                    
+                                </ul>
+                            </li>
+                            <li>
+                                Import:
+                                <ul>
+                                    <li>Babylon scene file can be converted from <i>.OBJ</i>, <i>.FBX</i>, <i>.MXB</i></li>
+                                    <li>Exporter for Blender</li>                                    
+                                </ul>
+                            </li>
+                        </ul>
+                    </div>
+                </div>
             </div>
         </div>
         <div id="opacityMask" class="hidden"></div>
@@ -184,13 +206,13 @@
                 <div id="controlsZone">
                     <div id="leftPart">
                         <p>
-                            <input type="checkbox" id="wireframe" />Wireframe
+                            <label><input type="checkbox" id="wireframe" />Wireframe</label>
                         </p>
                         <p>
-                            <input type="checkbox" id="enableStats" checked="true" />Statistics<br />
+                            <label><input type="checkbox" id="enableStats" checked="true" />Statistics</label>
                         </p>
                         <p>
-                            <input type="checkbox" id="collisions" checked="true" />Collisions<br />
+                            <label><input type="checkbox" id="collisions" checked="true" />Collisions</label>
                         </p>
                         <p>
                             <button id="fullscreen">Switch fullscreen mode</button>

+ 26 - 13
Samples/index.js

@@ -3,11 +3,16 @@
 
     // Demos
     var demos = [
-        { title: "HEART", scene: "heart", screenshot: "heart.jpg", size: "14 MB", big:true },
+        { title: "WORLDMONGER", url: "Scenes/Worldmonger/index.html", screenshot: "worldmonger.jpg", size: "8.5 MB", big: true },
+        { title: "HEART", scene: "heart", screenshot: "heart.jpg", size: "14 MB", },
         { title: "ESPILIT", scene: "Espilit", screenshot: "espilit.jpg", size: "50 MB" },
         { title: "WINDOWS CAFE", scene: "WCafe", screenshot: "wcafe.jpg", size: "28 MB" },
         {
-            title: "FLAT 2009", scene: "Flat2009", screenshot: "flat2009.jpg", size: "44 MB", onload: function () {
+            title: "FLAT 2009",
+            scene: "Flat2009",
+            screenshot: "flat2009.jpg",
+            size: "44 MB",
+            onload: function () {
                 var ecran = scene.getMeshByName("Ecran");
                 ecran.material.diffuseTexture = new BABYLON.VideoTexture("video", ["Scenes/Flat2009/babylonjs.mp4", "Scenes/Flat2009/babylonjs.webm"], 256, scene, true);
             }
@@ -15,7 +20,11 @@
         { title: "THE CAR", scene: "theCar", screenshot: "thecar.jpg", size: "100 MB" },
         { title: "VIPER", scene: "Viper", screenshot: "viper.jpg", size: "18 MB" },
         { title: "SPACESHIP", scene: "spaceship", screenshot: "spaceship.jpg", size: "1 MB" },
-        { title: "OMEGA CRUSHER", scene: "SpaceDek", screenshot: "omegacrusher.jpg", size: "10 MB" }];
+        {
+            title: "OMEGA CRUSHER", scene: "SpaceDek", screenshot: "omegacrusher.jpg", size: "10 MB", onload: function () {
+                scene.collisionsEnabled = false;
+            }
+        }];
 
     var tests = [
         { title: "HEIGHTMAP", id: 5, screenshot: "heightmap.jpg", size: "1.0 MB" },
@@ -53,6 +62,10 @@
                 document.getElementById("notSupported").className = "";
                 opacityMask.className = "";
             } else {
+                if (demo.url) {
+                    window.location = demo.url;
+                    return;
+                }
                 loadScene(demo.id !== undefined ? demo.id : demo.scene, function () {
                     if (demo.collisions !== undefined) {
                         scene.collisionsEnabled = demo.collisions;
@@ -165,7 +178,7 @@
 
             if (typeof name == "number") {
                 var newScene;
-                
+
                 switch (name) {
                     case 0:
                         newScene = CreateTestScene(engine);
@@ -186,7 +199,7 @@
                         newScene = CreateHeightMapTestScene(engine);
                         break;
                 }
-                
+
                 newScene.activeCamera.attachControl(canvas);
 
                 scene = newScene;
@@ -304,8 +317,8 @@
             aboutPanel.style.transform = "translateX(0px)";
         } else {
             aboutIsClosed = true;
-            aboutPanel.style.webkitTransform = "translateX(-500px)";
-            aboutPanel.style.transform = "translateX(-500px)";
+            aboutPanel.style.webkitTransform = "translateX(-120%)";
+            aboutPanel.style.transform = "translateX(-120%)";
         }
     });
 
@@ -326,8 +339,8 @@
     document.getElementById("menuPanel").addEventListener("click", function (evt) {
         if (!aboutIsClosed) {
             aboutIsClosed = true;
-            aboutPanel.style.webkitTransform = "translateX(-500px)";
-            aboutPanel.style.transform = "translateX(-500px)";
+            aboutPanel.style.webkitTransform = "translateX(-120%)";
+            aboutPanel.style.transform = "translateX(-120%)";
         }
     });
 
@@ -400,7 +413,7 @@
             engine.switchFullscreen(document.getElementById("rootDiv"));
         }
     });
-    
+
     touchCamera.addEventListener("click", function () {
         if (!scene) {
             return;
@@ -415,13 +428,13 @@
         camera.ellipsoid = scene.activeCamera.ellipsoid.clone();
         camera.checkCollisions = scene.activeCamera.checkCollisions;
         camera.applyGravity = scene.activeCamera.applyGravity;
-        
+
         camera.speed = scene.activeCamera.speed;
 
         scene.activeCamera.detachControl(canvas);
 
         scene.activeCamera = camera;
-        
+
         scene.activeCamera.attachControl(canvas);
     });
 
@@ -436,7 +449,7 @@
             scene.collisionsEnabled = collisions.checked;
         }
     });
-    
+
     // Query string
     var queryString = window.location.search;
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 11
babylon.1.0.6.js


+ 3 - 0
what's new.txt

@@ -1,3 +1,6 @@
+1.0.7:
+ - New demo: Worldmonger
+ - Improved IE shaders
 1.0.6:
  - Dynamic meshes
  - Skybox