2
0
Nicolas Cannasse 8 жил өмнө
parent
commit
5321bd7e7a
4 өөрчлөгдсөн 28 нэмэгдсэн , 15 устгасан
  1. 1 0
      .gitignore
  2. 1 0
      hide.hxml
  3. 1 1
      hide.hxproj
  4. 25 14
      hide/comp/Scene.hx

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 /bin/nwjs
 /bin/style.min.css
+/dump

+ 1 - 0
hide.hxml

@@ -3,6 +3,7 @@
 -main hide.ui.Ide
 -lib hxnodejs
 -lib heaps
+-lib hxbit
 -dce full
 --macro keep('h3d.prim')
 --macro include('hide.view')

+ 1 - 1
hide.hxproj

@@ -24,7 +24,7 @@
     <option noInlineOnDebug="False" />
     <option mainClass="hide.ui.Ide" />
     <option enabledebug="False" />
-    <option additional="-lib hxnodejs&#xA;-lib heaps&#xA;-dce full&#xA;&#xA;--macro keep('h3d.prim')&#xA;--macro include('hide.view')&#xA;--macro include('h3d.prim')" />
+    <option additional="-lib hxnodejs&#xA;-lib heaps&#xA;-lib hxbit&#xA;-dce full&#xA;&#xA;--macro keep('h3d.prim')&#xA;--macro include('hide.view')&#xA;--macro include('h3d.prim')" />
   </build>
   <!-- haxelib libraries -->
   <haxelib>

+ 25 - 14
hide/comp/Scene.hx

@@ -16,18 +16,29 @@ class SceneLoader extends h3d.impl.Serializable.SceneSerializer {
 	override function initSCNPaths(resPath:String, projectPath:String) {
 		this.resPath = resPath.split("\\").join("/");
 		this.projectPath = projectPath == null ? null : projectPath.split("\\").join("/");
-		trace(this.resPath, this.projectPath);
+	}
+
+	override function loadHMD(path:String) {
+		var path = resolvePath(path);
+		if( path == null )
+			throw "Missing HMD file " + path;
+		return scene.loadHMD(path, false);
 	}
 
 	override function resolveTexture(path:String) {
-		var t = null;
+		var path = resolvePath(path);
+		if( path == null )
+			return h3d.mat.Texture.fromColor(0xFF00FF);
+		return scene.loadTextureFile(scnPath, path);
+	}
+
+	function resolvePath( path : String ) {
+		var p = null;
 		if( projectPath != null )
-			t = scene.loadTextureFile(projectPath + resPath + "/" + scnPath.split("/").pop(), path);
-		if( t == null )
-			t = scene.loadTextureFile(scnPath, path);
-		if( t == null )
-			t = h3d.mat.Texture.fromColor(0xFF00FF);
-		return t;
+			p = scene.resolvePath(projectPath + resPath + "/" + scnPath.split("/").pop(), path);
+		if( p == null )
+			p = scene.resolvePath(scnPath, path);
+		return p;
 	}
 
 }
@@ -143,16 +154,16 @@ class Scene extends Component implements h3d.IDrawable {
 		return lib.loadAnimation();
 	}
 
-	function resolveTexturePath( modelPath : String, texturePath : String ) {
+	function resolvePath( modelPath : String, filePath : String ) {
 		inline function exists(path) return sys.FileSystem.exists(path);
-		if( exists(texturePath) )
-			return texturePath;
-		texturePath = texturePath.split("\\").join("/");
+		if( exists(filePath) )
+			return filePath;
+		filePath = filePath.split("\\").join("/");
 		modelPath = ide.getPath(modelPath);
 
 		var path = modelPath.split("/");
 		path.pop();
-		var relToModel = path.join("/") + "/" + texturePath.split("/").pop();
+		var relToModel = path.join("/") + "/" + filePath.split("/").pop();
 		if( exists(relToModel) )
 			return relToModel;
 
@@ -160,7 +171,7 @@ class Scene extends Component implements h3d.IDrawable {
 	}
 
 	function loadTextureFile( modelPath : String, texturePath : String ) {
-		var path = resolveTexturePath(modelPath, texturePath);
+		var path = resolvePath(modelPath, texturePath);
 		if( path != null ) {
 			var t = new h3d.mat.Texture(1,1);
 			t.clear(0x102030);