Selaa lähdekoodia

Updating Basic3D

Josh Engebretson 10 vuotta sitten
vanhempi
sitoutus
cb38fe8df3

+ 1 - 0
Basic3D/.gitignore

@@ -0,0 +1 @@
+Cache/*

+ 5 - 0
Basic3D/Resources.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "8b49c25ca8bcdf0fb11ea8bd906e9c60",
+	"FolderImporter": {}
+}

+ 5 - 0
Basic3D/Resources/Components.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "0aa23fc3d7a40b7df832022ffec034ea",
+	"FolderImporter": {}
+}

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

@@ -1,21 +0,0 @@
-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);
-
-}

+ 15 - 0
Basic3D/Resources/Components/Spinner.js

@@ -0,0 +1,15 @@
+"atomic component";
+
+var inspectorFields = {
+    speed: 1.0
+}
+
+exports.component = function(self) {
+
+    self.update = function(timeStep) {
+
+        self.node.yaw(timeStep * 75 * self.speed);
+
+    }
+
+}

+ 7 - 0
Basic3D/Resources/Components/Spinner.js.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "11e51c217632aa05ed426edd1374849d",
+	"JavascriptImporter": {
+		"IsComponentFile": true
+	}
+}

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

@@ -1,5 +0,0 @@
-<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>

+ 5 - 0
Basic3D/Resources/Models.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "859450fc1d20b9dd7e1e3da995cbdbd3",
+	"FolderImporter": {}
+}

BIN
Basic3D/Resources/Models/Chest.fbx


+ 9 - 0
Basic3D/Resources/Models/Chest.fbx.asset

@@ -0,0 +1,9 @@
+{
+	"version": 1,
+	"guid": "b00f01294b1cc469d4db9f862c9296b7",
+	"ModelImporter": {
+		"scale": 0.01,
+		"importAnimations": false,
+		"animInfo": []
+	}
+}

BIN
Basic3D/Resources/Models/Chest.mdl


+ 5 - 0
Basic3D/Resources/Models/Materials.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "6314dcdd026d028868140a1dde113f6d",
+	"FolderImporter": {}
+}

+ 15 - 0
Basic3D/Resources/Models/Materials/DefaultMaterial.material

@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<material>
+	<technique name="Techniques/Diff.xml" quality="0" loddistance="0" />
+	<texture unit="diffuse" name="Textures/chest.png" />
+	<parameter name="UOffset" value="1 0 0 0" />
+	<parameter name="VOffset" value="0 1 0 0" />
+	<parameter name="MatDiffColor" value="0.8 0.8 0.8 1" />
+	<parameter name="MatEmissiveColor" value="0 0 0 1" />
+	<parameter name="MatEnvMapColor" value="1 1 1" />
+	<parameter name="MatSpecColor" value="0.1 0.1 0.1 16" />
+	<cull value="ccw" />
+	<shadowcull value="ccw" />
+	<fill value="solid" />
+	<depthbias constant="0" slopescaled="0" />
+</material>

+ 5 - 0
Basic3D/Resources/Models/Materials/DefaultMaterial.material.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "3c0204d84c70d3c07c032dd8fbe84662",
+	"MaterialImporter": {}
+}

+ 5 - 0
Basic3D/Resources/Scenes.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "650634c8bf1c932ee41641c71d81de6f",
+	"FolderImporter": {}
+}

+ 71 - 0
Basic3D/Resources/Scenes/Scene.scene

@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<scene id="1">
+	<attribute name="Name" value="" />
+	<attribute name="Time Scale" value="1" />
+	<attribute name="Smoothing Constant" value="50" />
+	<attribute name="Snap Threshold" value="5" />
+	<attribute name="Elapsed Time" value="0" />
+	<attribute name="Next Replicated Node ID" value="366" />
+	<attribute name="Next Replicated Component ID" value="1979" />
+	<attribute name="Next Local Node ID" value="16778496" />
+	<attribute name="Next Local Component ID" value="16777216" />
+	<attribute name="Variables" />
+	<attribute name="Variable Names" value="" />
+	<component type="PhysicsWorld" id="1" />
+	<component type="Octree" id="2" />
+	<component type="DebugRenderer" id="3" />
+	<node id="2">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Zone" />
+		<attribute name="Position" value="0 0 0" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="Zone" id="4">
+			<attribute name="Bounding Box Min" value="-10000 -10000 -10000" />
+			<attribute name="Bounding Box Max" value="10000 10000 10000" />
+			<attribute name="Ambient Color" value="0.4 0.4 0.4 1" />
+		</component>
+	</node>
+	<node id="3">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="GlobalLight" />
+		<attribute name="Position" value="0 0 0" />
+		<attribute name="Rotation" value="0.888074 0.325058 -0.325058 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="Light" id="5">
+			<attribute name="Light Type" value="Directional" />
+			<attribute name="Cast Shadows" value="true" />
+			<attribute name="CSM Splits" value="10 20 50 0" />
+			<attribute name="View Size Quantize" value="1" />
+			<attribute name="View Size Minimum" value="5" />
+			<attribute name="Depth Constant Bias" value="0.00025" />
+			<attribute name="Depth Slope Bias" value="0.001" />
+		</component>
+	</node>
+	<node id="361">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Camera" />
+		<attribute name="Position" value="0 0 -2" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="Camera" id="1973" />
+	</node>
+	<node id="363">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Chest" />
+		<attribute name="Position" value="0 -0.374877 0" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="StaticModel" id="1975">
+			<attribute name="Model" value="Model;Cache/b00f01294b1cc469d4db9f862c9296b7.mdl" />
+			<attribute name="Material" value="Material;Models/Materials/DefaultMaterial.material" />
+		</component>
+		<component type="JSComponent" id="1976">
+			<attribute name="ComponentFile" value="JSComponentFile;Components/Spinner.js" />
+		</component>
+	</node>
+</scene>

+ 5 - 0
Basic3D/Resources/Scenes/Scene.scene.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "09945dd5d85bcaedfd1a2751aefc738b",
+	"SceneImporter": {}
+}

+ 5 - 0
Basic3D/Resources/Scripts.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "d64fec1650e6d0c76d855ba7e5720eb4",
+	"FolderImporter": {}
+}

+ 4 - 39
Basic3D/Resources/Scripts/main.js

@@ -1,46 +1,11 @@
-
 // This script is the main entry point of the game
 
-require("AtomicGame");
-
-Atomic.game.init(start, update);
-
-
-// called at the start of play
-function start() {
-
-	var game = Atomic.game;
-
-	// create a 2D scene
-	game.createScene3D();
-
-	var scene = game.scene;
+var scene = Atomic.player.loadScene("Scenes/Scene.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
+// called per frame, optional
 function update(timeStep) {
 
 
 }
+
+exports.update = update;

+ 7 - 0
Basic3D/Resources/Scripts/main.js.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "b26472030333c06522cb499311fbb1be",
+	"JavascriptImporter": {
+		"IsComponentFile": false
+	}
+}

+ 5 - 0
Basic3D/Resources/Textures.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "9ec8556a2f8b8bb06eeef7d1ae560a22",
+	"FolderImporter": {}
+}

+ 5 - 0
Basic3D/Resources/Textures/chest.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "6cfc1364a9a11584ea54f3384387e250",
+	"TextureImporter": {}
+}