Просмотр исходного кода

removed old s3d format (replaced by hide prefab)

ncannasse 7 лет назад
Родитель
Сommit
d9f6c0fdb3
2 измененных файлов с 0 добавлено и 135 удалено
  1. 0 44
      hxd/fmt/s3d/Data.hx
  2. 0 91
      hxd/fmt/s3d/Library.hx

+ 0 - 44
hxd/fmt/s3d/Data.hx

@@ -1,44 +0,0 @@
-package hxd.fmt.s3d;
-
-// an enum would have been better but is less JSON-friendly
-
-@:enum abstract ObjectType(String) {
-	var Object = "object";
-	var Particles = "particles";
-	var Trail = "trail";
-	var Constraint = "constraint";
-}
-
-typedef BaseObject = {
-	var type : ObjectType;
-	var name : String;
-	@:optional var x : Float;
-	@:optional var y : Float;
-	@:optional var z : Float;
-	@:optional var scaleX : Float;
-	@:optional var scaleY : Float;
-	@:optional var scaleZ : Float;
-	@:optional var rotationX : Float;
-	@:optional var rotationY : Float;
-	@:optional var rotationZ : Float;
-	@:optional var children : Array<BaseObject>;
-}
-
-typedef ObjectProperties = {> BaseObject,
-	var modelPath : String;
-	@:optional var animationPath : String;
-	@:optional var lock : Bool;
-}
-
-typedef ConstraintProperties = {> BaseObject,
-	var source : String;
-	var attach : String;
-}
-
-typedef ExtraProperties = {> BaseObject,
-	var data : Dynamic;
-}
-
-typedef Data = {
-	var content : Array<BaseObject>;
-}

+ 0 - 91
hxd/fmt/s3d/Library.hx

@@ -1,91 +0,0 @@
-package hxd.fmt.s3d;
-import hxd.fmt.s3d.Data;
-
-class Library {
-
-	public var data : Data;
-	var cache : h3d.prim.ModelCache;
-
-	public function new( ?cache ) {
-		this.cache = cache;
-		if( this.cache == null ) this.cache = new h3d.prim.ModelCache();
-		data = { content : [] };
-	}
-
-	public function load( content : Dynamic ) {
-		data = content;
-	}
-
-	public function save() {
-		return data;
-	}
-
-	public function makeInstance() {
-		var root = new h3d.scene.Object();
-		for( c in data.content )
-			makeObject(c, root);
-		return root;
-	}
-
-	public function makeObject( o : BaseObject, ?parent : h3d.scene.Object ) {
-		var obj = initObject(o, parent);
-		if( obj == null )
-			return null;
-		obj.name = o.name;
-		if( o.x != null ) obj.x = o.x;
-		if( o.y != null ) obj.y = o.y;
-		if( o.z != null ) obj.z = o.z;
-		if( o.scaleX != null ) obj.scaleX = o.scaleX;
-		if( o.scaleY != null ) obj.scaleY = o.scaleY;
-		if( o.scaleZ != null ) obj.scaleZ = o.scaleZ;
-		obj.setRotate(o.rotationX == null ? 0 : o.rotationX, o.rotationY == null ? 0 : o.rotationY, o.rotationZ == null ? 0 : o.rotationZ);
-		if( parent != null )
-			parent.addChild(obj);
-		if( o.children != null ) {
-			for( c in o.children )
-				makeObject(c, obj);
-		}
-		return obj;
-	}
-
-	function initObject( o : BaseObject, ?parent : h3d.scene.Object ) : h3d.scene.Object {
-		switch( o.type ) {
-		case Object:
-			var p : ObjectProperties = cast o;
-			var obj = loadModel(p.modelPath);
-			if( p.animationPath != null ) {
-				var a = obj.playAnimation(loadAnimation(p.animationPath));
-			}
-			return obj;
-		case Constraint:
-			var root = parent;
-			while( root != null && root.parent != null )
-				root = root.parent;
-			var p : ConstraintProperties = cast o;
-			if( root != null ) {
-				var obj = root.getObjectByName(p.source.split(".").pop());
-				if( obj != null ) obj.follow = root.getObjectByName(p.attach.split(".").pop());
-			}
-			return null;
-		case Particles:
-			var p : ExtraProperties = cast o;
-			var obj = new h3d.parts.GpuParticles();
-			obj.load(p.data);
-			return obj;
-		case Trail:
-			var p : ExtraProperties = cast o;
-			var obj = new h3d.scene.Trail();
-			obj.load(p.data);
-			return obj;
-		}
-	}
-
-	function loadModel( path : String ) : h3d.scene.Object {
-		return cache.loadModel(hxd.res.Loader.currentInstance.load(path).toModel());
-	}
-
-	function loadAnimation( path : String ) : h3d.anim.Animation {
-		return cache.loadAnimation(hxd.res.Loader.currentInstance.load(path).toModel());
-	}
-
-}