Browse Source

Adding Basic3D example

Josh Engebretson 11 years ago
parent
commit
73e3a02e3f

+ 0 - 0
Basic3D/Basic3D.atomic


+ 21 - 0
Basic3D/Resources/Components/Chest.js

@@ -0,0 +1,21 @@
+var game = Atomic.game;
+var node = self.node;
+
+function start() {
+
+    var cache = game.cache;
+
+    var model = node.createComponent("StaticModel");
+    model.setModel(cache.getResource("Model", "Models/Chest.mdl"));
+    model.setMaterial(cache.getResource("Material", "Materials/Chest.xml"));
+        
+    node.pitch(-90);    
+        
+}
+
+
+function update(timeStep) {
+
+   node.roll(timeStep * 75);
+
+}

+ 5 - 0
Basic3D/Resources/Materials/Chest.xml

@@ -0,0 +1,5 @@
+<material>
+    <technique name="Techniques/Diff.xml" quality="0" />
+    <texture unit="diffuse" name="Textures/chest.png" />
+    <parameter name="MatSpecColor" value="0.3 0.3 0.3 16" />
+</material>

BIN
Basic3D/Resources/Models/Chest.mdl


+ 41 - 0
Basic3D/Resources/Scripts/main.js

@@ -0,0 +1,41 @@
+
+// This script is the main entry point of the game
+
+// called at the start of play
+function Start() {
+
+	var game = Atomic.game;
+
+	// create a 2D scene
+	game.createScene3D();
+
+	var scene = game.scene;
+
+	// zone
+	var zoneNode = scene.createChild("Zone")
+    var zone = zoneNode.createComponent("Zone");
+    zone.boundingBox = [-1000, -1000, -1000, 1000, 1000 , 1000];
+    zone.ambientColor = [0.35, 0.35, 0.35];
+    zone.fogColor = [0.1, 0.1, 0.1, 1.0];
+    zone.fogStart = 10;
+    zone.fogEnd = 100;
+
+    game.cameraNode.position = [0, 2.5, -6];
+    game.cameraNode.pitch(20);
+
+    var lightNode = scene.createChild("Directional Light");
+    lightNode.direction = [0.6, -1.0, 0.8];
+    var light = lightNode.createComponent("Light")
+    light.lightType = Atomic.LIGHT_DIRECTIONAL;
+
+	// create the game component
+	var node = game.scene.createChild("Chest");
+	node.createJSComponent("Chest");
+
+}
+
+// called per frame
+function Update(timeStep) {
+
+
+}

BIN
Basic3D/Resources/Textures/chest.png