2
0
Эх сурвалжийг харах

remove old hxbit serialization support

Nicolas Cannasse 4 жил өмнө
parent
commit
02c13a711f

+ 9 - 26
h3d/anim/Animation.hx

@@ -19,22 +19,22 @@ class AnimatedObject {
 
 
 }
 }
 
 
-class Animation implements hxd.impl.Serializable {
+class Animation {
 
 
 	static inline var EPSILON = 0.000001;
 	static inline var EPSILON = 0.000001;
 
 
-	@:s public var name : String;
-	@:s public var resourcePath : String;
-	@:s public var frameCount(default, null) : Int;
-	@:s public var sampling(default,null) : Float;
-	@:s public var frame(default, null) : Float;
+	public var name : String;
+	public var resourcePath : String;
+	public var frameCount(default, null) : Int;
+	public var sampling(default,null) : Float;
+	public var frame(default, null) : Float;
 
 
-	@:s public var speed : Float;
+	public var speed : Float;
 	public var onAnimEnd : Void -> Void;
 	public var onAnimEnd : Void -> Void;
 	public var onEvent : String -> Void;
 	public var onEvent : String -> Void;
 
 
-	@:s public var pause : Bool;
-	@:s public var loop : Bool;
+	public var pause : Bool;
+	public var loop : Bool;
 
 
 	public var events(default, null) : Array<Array<String>>;
 	public var events(default, null) : Array<Array<String>>;
 
 
@@ -282,21 +282,4 @@ class Animation implements hxd.impl.Serializable {
 		return name;
 		return name;
 	}
 	}
 
 
-	#if (hxbit && !macro && heaps_enable_serialize)
-	public function unserialize(ctx) {
-		super.unserialize(ctx);
-		if( objects == null ) objects = [];
-	}
-
-	function customSerialize(ctx:hxbit.Serializer) {
-	}
-
-	function customUnserialize(ctx:hxbit.Serializer) {
-		var l = cast(ctx, hxd.fmt.hsd.Serializer).loadAnimation(resourcePath);
-		var objects = [for( a in l.objects ) a.clone()];
-		l.clone(this);
-		this.objects = objects;
-	}
-	#end
-
 }
 }

+ 5 - 46
h3d/anim/SmoothTarget.hx

@@ -17,11 +17,11 @@ private class SmoothObject extends Animation.AnimatedObject {
 
 
 class SmoothTarget extends Animation {
 class SmoothTarget extends Animation {
 
 
-	@:s public var target : Animation;
-	@:s public var blend : Float;
-	@:s public var duration : Float;
-	@:s public var ignoreTranslate = false;
-	@:s public var easing : Float = 0.;
+	public var target : Animation;
+	public var blend : Float;
+	public var duration : Float;
+	public var ignoreTranslate = false;
+	public var easing : Float = 0.;
 
 
 	public function new( target : h3d.anim.Animation, duration = 0.5 ) {
 	public function new( target : h3d.anim.Animation, duration = 0.5 ) {
 		super("SmoothTarget(" + target.name+")", target.frameCount, target.sampling);
 		super("SmoothTarget(" + target.name+")", target.frameCount, target.sampling);
@@ -196,45 +196,4 @@ class SmoothTarget extends Animation {
 	}
 	}
 	#end
 	#end
 
 
-	#if (hxbit && !macro)
-	function customSerialize( ctx : hxbit.Serializer ) {
-		var objects : Array<SmoothObject> = cast objects;
-		var objects = [for( o in objects ) if( o.tmpMatrix != null ) o];
-		ctx.addInt(objects.length);
-		for( o in objects ) {
-			ctx.addString(o.objectName);
-			ctx.addFloat(o.tx);
-			ctx.addFloat(o.ty);
-			ctx.addFloat(o.tz);
-			ctx.addFloat(o.sx);
-			ctx.addFloat(o.sy);
-			ctx.addFloat(o.sz);
-			ctx.addFloat(o.q.x);
-			ctx.addFloat(o.q.y);
-			ctx.addFloat(o.q.z);
-			ctx.addFloat(o.q.w);
-		}
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		var count = ctx.getInt();
-		var cur = 0;
-		objects = [];
-		for( i in 0...count ) {
-			var o = new SmoothObject(ctx.getString());
-			o.tx = ctx.getFloat();
-			o.ty = ctx.getFloat();
-			o.tz = ctx.getFloat();
-			o.sx = ctx.getFloat();
-			o.sy = ctx.getFloat();
-			o.sz = ctx.getFloat();
-			o.q = new h3d.Quat();
-			o.q.x = ctx.getFloat();
-			o.q.y = ctx.getFloat();
-			o.q.z = ctx.getFloat();
-			o.q.w = ctx.getFloat();
-			objects.push(o);
-		}
-	}
-	#end
-
 }
 }

+ 2 - 2
h3d/anim/Transition.hx

@@ -2,8 +2,8 @@ package h3d.anim;
 
 
 class Transition extends Animation {
 class Transition extends Animation {
 
 
-	@:s public var anim1 : Animation;
-	@:s public var anim2 : Animation;
+	public var anim1 : Animation;
+	public var anim2 : Animation;
 
 
 	public function new( transitionName : String, anim1 : Animation, anim2 : Animation ) {
 	public function new( transitionName : String, anim1 : Animation, anim2 : Animation ) {
 		var r1 = 1, r2 = 1;
 		var r1 = 1, r2 = 1;

+ 0 - 18
h3d/col/Bounds.hx

@@ -408,24 +408,6 @@ class Bounds implements Collider {
 		prim.addNormals();
 		prim.addNormals();
 		return new h3d.scene.Mesh(prim);
 		return new h3d.scene.Mesh(prim);
 	}
 	}
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-		ctx.addFloat(xMin);
-		ctx.addFloat(xMax);
-		ctx.addFloat(yMin);
-		ctx.addFloat(yMax);
-		ctx.addFloat(zMin);
-		ctx.addFloat(zMax);
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		xMin = ctx.getFloat();
-		xMax = ctx.getFloat();
-		yMin = ctx.getFloat();
-		yMax = ctx.getFloat();
-		zMin = ctx.getFloat();
-		zMax = ctx.getFloat();
-	}
-	#end
 	#end
 	#end
 
 
 }
 }

+ 0 - 16
h3d/col/Capsule.hx

@@ -137,22 +137,6 @@ class Capsule implements Collider {
 		obj.setPosition(midPoint.x, midPoint.y, midPoint.z);
 		obj.setPosition(midPoint.x, midPoint.y, midPoint.z);
 		return obj;
 		return obj;
 	}
 	}
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-		ctx.addFloat(a.x);
-		ctx.addFloat(a.y);
-		ctx.addFloat(a.z);
-		ctx.addFloat(b.x);
-		ctx.addFloat(b.y);
-		ctx.addFloat(b.z);
-		ctx.addFloat(r);
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		a = new Point(ctx.getFloat(), ctx.getFloat(), ctx.getFloat());
-		b = new Point(ctx.getFloat(), ctx.getFloat(), ctx.getFloat());
-		r = ctx.getFloat();
-	}
-	#end
 	#end
 	#end
 
 
 }
 }

+ 4 - 23
h3d/col/Collider.hx

@@ -1,6 +1,6 @@
 package h3d.col;
 package h3d.col;
 
 
-interface Collider extends hxd.impl.Serializable.StructSerializable {
+interface Collider {
 
 
 	/**
 	/**
 		Returns the distance of intersection between the ray and the collider, or negative if no collision.
 		Returns the distance of intersection between the ray and the collider, or negative if no collision.
@@ -17,10 +17,10 @@ interface Collider extends hxd.impl.Serializable.StructSerializable {
 }
 }
 
 
 
 
-class OptimizedCollider implements hxd.impl.Serializable implements Collider {
+class OptimizedCollider implements Collider {
 
 
-	@:s public var a : Collider;
-	@:s public var b : Collider;
+	public var a : Collider;
+	public var b : Collider;
 
 
 	public function new(a, b) {
 	public function new(a, b) {
 		this.a = a;
 		this.a = a;
@@ -58,12 +58,6 @@ class OptimizedCollider implements hxd.impl.Serializable implements Collider {
 			ret.addChild(bobj);
 			ret.addChild(bobj);
 		return ret;
 		return ret;
 	}
 	}
-	#if hxbit
-	function customSerialize(ctx:hxbit.Serializer) {
-	}
-	function customUnserialize(ctx:hxbit.Serializer) {
-	}
-	#end
 	#end
 	#end
 
 
 }
 }
@@ -122,19 +116,6 @@ class GroupCollider implements Collider {
 		}
 		}
 		return ret;
 		return ret;
 	}
 	}
-	#if (hxbit && heaps_enable_serialize)
-
-	function customSerialize(ctx:hxbit.Serializer) {
-		ctx.addInt(colliders.length);
-		for( c in colliders )
-			ctx.addStruct(c);
-	}
-
-	function customUnserialize(ctx:hxbit.Serializer) {
-		colliders = [for( i in 0...ctx.getInt() ) ctx.getStruct()];
-	}
-
-	#end
 	#end
 	#end
 
 
 
 

+ 3 - 10
h3d/col/ObjectCollider.hx

@@ -1,9 +1,9 @@
 package h3d.col;
 package h3d.col;
 
 
-class ObjectCollider implements Collider implements hxd.impl.Serializable {
+class ObjectCollider implements Collider {
 
 
-	@:s public var obj : h3d.scene.Object;
-	@:s public var collider : Collider;
+	public var obj : h3d.scene.Object;
+	public var collider : Collider;
 	static var TMP_RAY = new Ray();
 	static var TMP_RAY = new Ray();
 	static var TMP_MAT = new Matrix();
 	static var TMP_MAT = new Matrix();
 
 
@@ -75,11 +75,4 @@ class ObjectCollider implements Collider implements hxd.impl.Serializable {
 	}
 	}
 	#end
 	#end
 
 
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-	}
-	#end
-
 }
 }

+ 0 - 14
h3d/col/Polygon.hx

@@ -154,13 +154,6 @@ class TriPlane implements Collider {
 		prim.addNormals();
 		prim.addNormals();
 		return new h3d.scene.Mesh(prim);
 		return new h3d.scene.Mesh(prim);
 	}
 	}
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-		throw "Cannot serialize "+this;
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-	}
-	#end
 	#end
 	#end
 
 
 }
 }
@@ -291,13 +284,6 @@ class Polygon implements Collider {
 		prim.addNormals();
 		prim.addNormals();
 		return new h3d.scene.Mesh(prim);
 		return new h3d.scene.Mesh(prim);
 	}
 	}
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-		throw "Cannot serialize "+this;
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-	}
-	#end
 	#end
 	#end
 
 
 	public static function fromPolygon2D( p : h2d.col.Polygon, z = 0. ) {
 	public static function fromPolygon2D( p : h2d.col.Polygon, z = 0. ) {

+ 0 - 24
h3d/col/PolygonBuffer.hx

@@ -110,30 +110,6 @@ class PolygonBuffer implements Collider {
 		prim.addNormals();
 		prim.addNormals();
 		return new h3d.scene.Mesh(prim);
 		return new h3d.scene.Mesh(prim);
 	}
 	}
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-		if( source == null )
-			throw "Cannot serialize " + this;
-		ctx.addString(source.entry.path);
-		ctx.addString(source.geometryName);
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		var file = ctx.getString();
-		var name = ctx.getString();
-		var ctx : hxd.fmt.hsd.Serializer = cast ctx;
-		var lib = ctx.loadHMD(file);
-		var gindex = -1;
-		for( h in lib.header.models )
-			if( h.name == name ) {
-				gindex = h.geometry;
-				break;
-			}
-		if( gindex < 0 )
-			throw file+" does not have model " + name;
-		var prim = @:privateAccess lib.makePrimitive(gindex);
-		@:privateAccess prim.initCollider(this);
-	}
-	#end
 	#end
 	#end
 
 
 }
 }

+ 3 - 11
h3d/col/SkinCollider.hx

@@ -2,10 +2,10 @@ package h3d.col;
 
 
 @:access(h3d.col.PolygonBuffer)
 @:access(h3d.col.PolygonBuffer)
 @:access(h3d.scene.Skin)
 @:access(h3d.scene.Skin)
-class SkinCollider implements hxd.impl.Serializable implements Collider {
+class SkinCollider implements Collider {
 
 
-	@:s var obj : h3d.scene.Skin;
-	@:s var col : PolygonBuffer;
+	var obj : h3d.scene.Skin;
+	var col : PolygonBuffer;
 	var currentBounds : h3d.col.Bounds;
 	var currentBounds : h3d.col.Bounds;
 	var transform : PolygonBuffer;
 	var transform : PolygonBuffer;
 	var lastFrame = -1;
 	var lastFrame = -1;
@@ -97,14 +97,6 @@ class SkinCollider implements hxd.impl.Serializable implements Collider {
 		ret.ignoreParentTransform = true;
 		ret.ignoreParentTransform = true;
 		return ret;
 		return ret;
 	}
 	}
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		this.transform = new PolygonBuffer();
-		this.transform.setData(col.buffer.copy(), col.indexes, col.startIndex, col.triCount);
-	}
-	#end
 	#end
 	#end
 
 
 }
 }

+ 0 - 14
h3d/col/Sphere.hx

@@ -93,20 +93,6 @@ class Sphere implements Collider {
 		prim.addNormals();
 		prim.addNormals();
 		return new h3d.scene.Mesh(prim);
 		return new h3d.scene.Mesh(prim);
 	}
 	}
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-		ctx.addFloat(x);
-		ctx.addFloat(y);
-		ctx.addFloat(z);
-		ctx.addFloat(r);
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		x = ctx.getFloat();
-		y = ctx.getFloat();
-		z = ctx.getFloat();
-		r = ctx.getFloat();
-	}
-	#end
 	#end
 	#end
 
 
 }
 }

+ 3 - 3
h3d/mat/BaseMaterial.hx

@@ -2,10 +2,10 @@ package h3d.mat;
 import h3d.mat.Data;
 import h3d.mat.Data;
 import h3d.mat.Pass;
 import h3d.mat.Pass;
 
 
-class BaseMaterial extends hxd.impl.AnyProps implements hxd.impl.Serializable {
+class BaseMaterial extends hxd.impl.AnyProps {
 
 
-	@:s var passes : Pass;
-	@:s public var name : String;
+	var passes : Pass;
+	public var name : String;
 	public var mainPass(get, never) : Pass;
 	public var mainPass(get, never) : Pass;
 
 
 	function new(?shader:hxsl.Shader) {
 	function new(?shader:hxsl.Shader) {

+ 0 - 27
h3d/mat/Material.hx

@@ -306,33 +306,6 @@ class Material extends BaseMaterial {
 	}
 	}
 	#end
 	#end
 
 
-
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-		// other props are serialized in BaseMaterial !
-		ctx.addInt(blendMode.getIndex());
-		ctx.addBool(castShadows);
-		ctx.addBool(receiveShadows);
-		ctx.addDynamic(props);
-	}
-
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		var last = mainPass.shaders;
-		while( last.next != null ) last = last.next;
-		mshader = cast last.s;
-
-		// prevent changing the passes while setting blendmode/props
-		// since we have unserialized them, they are correctly set already
-		var old = passes;
-		passes = null;
-		blendMode = BlendMode.createByIndex(ctx.getInt());
-		castShadows = ctx.getBool();
-		receiveShadows = ctx.getBool();
-		props = ctx.getDynamic();
-		passes = old;
-	}
-	#end
-
 	/*
 	/*
 		Shortcut to create a material for the current renderer setup using the specific diffuse texture.
 		Shortcut to create a material for the current renderer setup using the specific diffuse texture.
 	*/
 	*/

+ 6 - 37
h3d/mat/Pass.hx

@@ -5,16 +5,16 @@ import h3d.mat.Data;
 #if !macro
 #if !macro
 @:build(hxd.impl.BitsBuilder.build())
 @:build(hxd.impl.BitsBuilder.build())
 #end
 #end
-class Pass implements hxd.impl.Serializable {
+class Pass {
 
 
-	@:s public var name(default, null) : String;
+	public var name(default, null) : String;
 	var flags : Int;
 	var flags : Int;
 	var passId : Int;
 	var passId : Int;
-	@:s var bits : Int = 0;
-	@:s var parentPass : Pass;
+	var bits : Int = 0;
+	var parentPass : Pass;
 	var parentShaders : hxsl.ShaderList;
 	var parentShaders : hxsl.ShaderList;
 	var shaders : hxsl.ShaderList;
 	var shaders : hxsl.ShaderList;
-	@:s var nextPass : Pass;
+	var nextPass : Pass;
 
 
 	@:bits(flags) public var enableLights : Bool;
 	@:bits(flags) public var enableLights : Bool;
 	/**
 	/**
@@ -43,7 +43,7 @@ class Pass implements hxd.impl.Serializable {
 	@:bits(bits) public var wireframe : Bool;
 	@:bits(bits) public var wireframe : Bool;
 	public var colorMask : Int;
 	public var colorMask : Int;
 
 
-	@:s public var stencil : Stencil;
+	public var stencil : Stencil;
 
 
 	// one bit for internal engine usage
 	// one bit for internal engine usage
 	@:bits(bits) @:noCompletion var reserved : Bool;
 	@:bits(bits) @:noCompletion var reserved : Bool;
@@ -290,37 +290,6 @@ class Pass implements hxd.impl.Serializable {
 			return h3d.Engine.getCurrent().driver.getNativeShaderCode(shader);
 			return h3d.Engine.getCurrent().driver.getNativeShaderCode(shader);
 		}
 		}
 	}
 	}
-
-	#if hxbit
-
-	public function customSerialize( ctx : hxbit.Serializer ) {
-		var ctx : hxd.fmt.hsd.Serializer = cast ctx;
-		var s = shaders;
-		while( s != parentShaders ) {
-			ctx.addShader(s.s);
-			s = s.next;
-		}
-		ctx.addShader(null);
-	}
-	public function customUnserialize( ctx : hxbit.Serializer ) {
-		var ctx : hxd.fmt.hsd.Serializer = cast ctx;
-		var head = null;
-		while( true ) {
-			var s = ctx.getShader();
-			if( s == null ) break;
-			var sl = new hxsl.ShaderList(s);
-			if( head == null ) {
-				head = shaders = sl;
-			} else {
-				head.next = sl;
-				head = sl;
-			}
-		}
-		setPassName(name);
-		loadBits(bits);
-	}
-	#end
-
 	#end
 	#end
 
 
 }
 }

+ 3 - 12
h3d/mat/Stencil.hx

@@ -5,10 +5,10 @@ import h3d.mat.Data;
 #if !macro
 #if !macro
 @:build(hxd.impl.BitsBuilder.build())
 @:build(hxd.impl.BitsBuilder.build())
 #end
 #end
-class Stencil implements hxd.impl.Serializable {
+class Stencil {
 
 
-	@:s var maskBits  : Int = 0;
-	@:s var opBits    : Int = 0;
+	var maskBits  : Int = 0;
+	var opBits    : Int = 0;
 
 
 	@:bits(maskBits, 8) public var readMask : Int;
 	@:bits(maskBits, 8) public var readMask : Int;
 	@:bits(maskBits, 8) public var writeMask : Int;
 	@:bits(maskBits, 8) public var writeMask : Int;
@@ -65,13 +65,4 @@ class Stencil implements hxd.impl.Serializable {
 		maskBits = s.maskBits;
 		maskBits = s.maskBits;
 	}
 	}
 
 
-	#if (!macro && hxbit)
-	public function customSerialize( ctx : hxbit.Serializer ) {
-	}
-	public function customUnserialize( ctx : hxbit.Serializer ) {
-		loadMaskBits(maskBits);
-		loadOpBits(opBits);
-	}
-	#end
-
 }
 }

+ 0 - 29
h3d/parts/GpuParticles.hx

@@ -1009,33 +1009,4 @@ class GpuParticles extends h3d.scene.MultiMaterial {
 		}
 		}
 	}
 	}
 
 
-	#if (hxbit && !macro && heaps_enable_serialize)
-	override function serialize( ctx : hxbit.Serializer ) {
-		var oldMat = materials;
-		primitive = null;
-		materials = [];
-		super.serialize(ctx);
-		materials = oldMat;
-	}
-	override function customSerialize(ctx:hxbit.Serializer) {
-		super.customSerialize(ctx);
-		ctx.addString(resourcePath);
-		ctx.addFloat(amount);
-		if( resourcePath == null )
-			ctx.addDynamic(save());
-
-	}
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		super.customUnserialize(ctx);
-		resourcePath = ctx.getString();
-		amount = ctx.getFloat();
-		groups = [];
-		bounds = new h3d.col.Bounds();
-		if( resourcePath != null )
-			load(haxe.Json.parse(hxd.res.Loader.currentInstance.load(resourcePath).toText()), resourcePath);
-		else
-			load(ctx.getDynamic());
-	}
-	#end
-
 }
 }

+ 0 - 61
h3d/prim/BigPrimitive.hx

@@ -311,65 +311,4 @@ class BigPrimitive extends Primitive {
 			tmpIdx[idxPos++] = idx[i+startTri*3] + start;
 			tmpIdx[idxPos++] = idx[i+startTri*3] + start;
 	}
 	}
 
 
-	#if hxbit
-	override function customSerialize(ctx:hxbit.Serializer) {
-		flush();
-		ctx.addBool(isRaw);
-		ctx.addInt(stride);
-		ctx.addFloat(bounds.xMin);
-		ctx.addFloat(bounds.yMin);
-		ctx.addFloat(bounds.zMin);
-		ctx.addFloat(bounds.xMax);
-		ctx.addFloat(bounds.yMax);
-		ctx.addFloat(bounds.zMax);
-		ctx.addInt(buffers.length);
-		var reqSize = 0;
-		for( a in allIndexes ) {
-			var sz = a.count << 1;
-			if( reqSize < sz ) reqSize = sz;
-		}
-		for( b in buffers ) {
-			var sz = (b.vertices * stride) << 2;
-			if( reqSize < sz ) reqSize = sz;
-		}
-		var tmpBytes = haxe.io.Bytes.alloc(reqSize);
-		for( i in 0...buffers.length ) {
-			var idx = allIndexes[i];
-			idx.readBytes(tmpBytes, 0, idx.count);
-			ctx.addInt(idx.count);
-			ctx.addBytesSub(tmpBytes, 0, idx.count << 1);
-
-			var b = buffers[i];
-			b.readBytes(tmpBytes, 0, b.vertices);
-			ctx.addInt(b.vertices);
-			ctx.addBytesSub(tmpBytes, 0, b.vertices * stride << 2);
-		}
-	}
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		isRaw = ctx.getBool();
-		stride = ctx.getInt();
-		bounds = new h3d.col.Bounds();
-		bounds.xMin = ctx.getFloat();
-		bounds.yMin = ctx.getFloat();
-		bounds.zMin = ctx.getFloat();
-		bounds.xMin = ctx.getFloat();
-		bounds.yMax = ctx.getFloat();
-		bounds.zMax = ctx.getFloat();
-		var count = ctx.getInt();
-		buffers = [];
-		allIndexes = [];
-		for( i in 0...count ) {
-			var nidx = ctx.getInt();
-			var idx = new h3d.Indexes(nidx);
-			idx.uploadBytes(ctx.getBytes(), 0, nidx);
-			allIndexes.push(idx);
-
-			var nvert = ctx.getInt();
-			var buf = new h3d.Buffer(nvert, stride);
-			buf.uploadBytes(ctx.getBytes(), 0, nvert);
-			buffers.push(buf);
-		}
-	}
-	#end
-
 }
 }

+ 3 - 3
h3d/prim/Cube.hx

@@ -3,9 +3,9 @@ import h3d.col.Point;
 
 
 class Cube extends Polygon {
 class Cube extends Polygon {
 
 
-	@:s var sizeX : Float;
-	@:s var sizeY : Float;
-	@:s var sizeZ : Float;
+	var sizeX : Float;
+	var sizeY : Float;
+	var sizeZ : Float;
 
 
 	public function new( x = 1., y = 1., z = 1., centered = false )
 	public function new( x = 1., y = 1., z = 1., centered = false )
 	{
 	{

+ 0 - 24
h3d/prim/HMDModel.hx

@@ -234,28 +234,4 @@ class HMDModel extends MeshPrimitive {
 		return collider;
 		return collider;
 	}
 	}
 
 
-	#if hxbit
-	override function customSerialize(ctx:hxbit.Serializer) {
-		ctx.addString(lib.resource.entry.path);
-		for( m in lib.header.models )
-			if( lib.header.geometries[m.geometry] == this.data ) {
-				ctx.addString(m.name);
-				break;
-			}
-	}
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		var libPath = ctx.getString();
-		var modelPath = ctx.getString();
-		var ctx : hxd.fmt.hsd.Serializer = cast ctx;
-		lib = ctx.loadHMD(libPath);
-		for( m in lib.header.models )
-			if( m.name == modelPath ) {
-				this.data = lib.header.geometries[m.geometry];
-				@:privateAccess lib.cachedPrimitives[m.geometry] = this;
-				break;
-			}
-		dataPosition = lib.header.dataPosition;
-	}
-	#end
-
 }
 }

+ 4 - 79
h3d/prim/Polygon.hx

@@ -9,10 +9,10 @@ class Polygon extends MeshPrimitive {
 	public var uvs : Array<UV>;
 	public var uvs : Array<UV>;
 	public var idx : hxd.IndexBuffer;
 	public var idx : hxd.IndexBuffer;
 	public var colors : Array<Point>;
 	public var colors : Array<Point>;
-	@:s var scaled = 1.;
-	@:s var translatedX = 0.;
-	@:s var translatedY = 0.;
-	@:s var translatedZ = 0.;
+	var scaled = 1.;
+	var translatedX = 0.;
+	var translatedY = 0.;
+	var translatedZ = 0.;
 
 
 	public function new( points, ?idx ) {
 	public function new( points, ?idx ) {
 		this.points = points;
 		this.points = points;
@@ -287,79 +287,4 @@ class Polygon extends MeshPrimitive {
 			engine.renderMultiBuffers(bufs, engine.mem.triIndexes, 0, triCount());
 			engine.renderMultiBuffers(bufs, engine.mem.triIndexes, 0, triCount());
 	}
 	}
 
 
-	#if hxbit
-	override function customSerialize(ctx:hxbit.Serializer) {
-		ctx.addInt(points.length);
-		for( p in points ) {
-			ctx.addDouble(p.x);
-			ctx.addDouble(p.y);
-			ctx.addDouble(p.z);
-		}
-		if( normals == null )
-			ctx.addInt(0);
-		else {
-			ctx.addInt(normals.length);
-			for( p in normals ) {
-				ctx.addDouble(p.x);
-				ctx.addDouble(p.y);
-				ctx.addDouble(p.z);
-			}
-		}
-		if( tangents == null )
-			ctx.addInt(0);
-		else {
-			ctx.addInt(tangents.length);
-			for( p in tangents ) {
-				ctx.addDouble(p.x);
-				ctx.addDouble(p.y);
-				ctx.addDouble(p.z);
-			}
-		}
-		if( uvs == null )
-			ctx.addInt(0);
-		else {
-			ctx.addInt(uvs.length);
-			for( uv in uvs ) {
-				ctx.addDouble(uv.u);
-				ctx.addDouble(uv.v);
-			}
-		}
-		if( idx == null )
-			ctx.addInt(0);
-		else {
-			ctx.addInt(idx.length);
-			for( i in idx )
-				ctx.addInt(i);
-		}
-		if( colors == null )
-			ctx.addInt(0);
-		else {
-			ctx.addInt(colors.length);
-			for( c in colors ) {
-				ctx.addDouble(c.x);
-				ctx.addDouble(c.y);
-				ctx.addDouble(c.z);
-			}
-		}
-	}
-
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		points = [for( i in 0...ctx.getInt() ) new h3d.col.Point(ctx.getDouble(), ctx.getDouble(), ctx.getDouble())];
-		normals = [for( i in 0...ctx.getInt() ) new h3d.col.Point(ctx.getDouble(), ctx.getDouble(), ctx.getDouble())];
-		tangents = [for( i in 0...ctx.getInt() ) new h3d.col.Point(ctx.getDouble(), ctx.getDouble(), ctx.getDouble())];
-		uvs = [for( i in 0...ctx.getInt() ) new UV(ctx.getDouble(), ctx.getDouble())];
-		if( normals.length == 0 ) normals = null;
-		if( uvs.length == 0 ) uvs = null;
-		var nindex = ctx.getInt();
-		if( nindex > 0 ) {
-			idx = new hxd.IndexBuffer();
-			idx.grow(nindex);
-			for( i in 0...nindex )
-				idx[i] = ctx.getInt();
-		}
-		colors = [for( i in 0...ctx.getInt() ) new h3d.col.Point(ctx.getDouble(), ctx.getDouble(), ctx.getDouble())];
-		if( colors.length == 0 ) colors = null;
-	}
-	#end
-
 }
 }

+ 1 - 10
h3d/prim/Primitive.hx

@@ -4,7 +4,7 @@ package h3d.prim;
 	h3d.prim.Primitive is the base class for all 3D primitives.
 	h3d.prim.Primitive is the base class for all 3D primitives.
 	You can't create an instance of it and need to use one of its subclasses.
 	You can't create an instance of it and need to use one of its subclasses.
 **/
 **/
-class Primitive implements hxd.impl.Serializable {
+class Primitive {
 
 
 	/**
 	/**
 		The primitive vertex buffer, holding its vertexes data.
 		The primitive vertex buffer, holding its vertexes data.
@@ -133,13 +133,4 @@ class Primitive implements hxd.impl.Serializable {
 		return Type.getClassName(Type.getClass(this)).split(".").pop();
 		return Type.getClassName(Type.getClass(this)).split(".").pop();
 	}
 	}
 
 
-	#if hxbit
-	function customSerialize( ctx : hxbit.Serializer ) {
-		throw "Cannot serialize " + toString();
-	}
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		throw "customUnserialize not implemented on " + toString();
-	}
-	#end
-
 }
 }

+ 4 - 4
h3d/prim/Sphere.hx

@@ -3,12 +3,12 @@ import h3d.col.Point;
 
 
 class Sphere extends Polygon {
 class Sphere extends Polygon {
 
 
-	@:s var ray : Float;
-	@:s var segsH : Int;
-	@:s var segsW : Int;
+	var ray : Float;
+	var segsH : Int;
+	var segsW : Int;
 
 
 	// Use 1 for a full sphere, 0.5 for a half sphere
 	// Use 1 for a full sphere, 0.5 for a half sphere
-	@:s var portion : Float;
+	var portion : Float;
 
 
 	public function new( ray = 1., segsW = 8, segsH = 6, portion = 1. ) {
 	public function new( ray = 1., segsW = 8, segsH = 6, portion = 1. ) {
 		this.ray = ray;
 		this.ray = ray;

+ 0 - 1
h3d/scene/CameraController.hx

@@ -38,7 +38,6 @@ class CameraController extends h3d.scene.Object {
 		super(parent);
 		super(parent);
 		name = "CameraController";
 		name = "CameraController";
 		set(distance);
 		set(distance);
-		flags.set(FNoSerialize,true);
 		curPos.load(targetPos);
 		curPos.load(targetPos);
 		curOffset.load(targetOffset);
 		curOffset.load(targetOffset);
 	}
 	}

+ 0 - 9
h3d/scene/Graphics.hx

@@ -297,13 +297,4 @@ class Graphics extends Mesh {
 		curZ = z;
 		curZ = z;
 	}
 	}
 
 
-	#if (hxbit && !macro && heaps_enable_serialize)
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		super.customUnserialize(ctx);
-		lineShader = material.mainPass.getShader(h3d.shader.LineShader);
-		tmpPoints = [];
-		bprim = cast primitive;
-	}
-	#end
-
 }
 }

+ 7 - 7
h3d/scene/Interactive.hx

@@ -5,33 +5,33 @@ class Interactive extends Object implements hxd.SceneEvents.Interactive {
 	var debugObj : Object;
 	var debugObj : Object;
 	public var showDebug(default, set) : Bool = false;
 	public var showDebug(default, set) : Bool = false;
 
 
-	@:s public var shape : h3d.col.Collider;
+	public var shape : h3d.col.Collider;
 
 
 	/**
 	/**
 		If several interactive conflicts, the preciseShape (if defined) can be used to distinguish between the two.
 		If several interactive conflicts, the preciseShape (if defined) can be used to distinguish between the two.
 	**/
 	**/
-	@:s public var preciseShape : Null<h3d.col.Collider>;
+	public var preciseShape : Null<h3d.col.Collider>;
 
 
 	/**
 	/**
 		In case of conflicting shapes, usually the one in front of the camera is prioritized, unless you set an higher priority.
 		In case of conflicting shapes, usually the one in front of the camera is prioritized, unless you set an higher priority.
 	**/
 	**/
-	@:s public var priority : Int;
+	public var priority : Int;
 
 
 	public var cursor(default,set) : Null<hxd.Cursor>;
 	public var cursor(default,set) : Null<hxd.Cursor>;
 	/**
 	/**
 		Set the default `cancel` mode (see `hxd.Event`), default to false.
 		Set the default `cancel` mode (see `hxd.Event`), default to false.
 	**/
 	**/
-	@:s public var cancelEvents : Bool = false;
+	public var cancelEvents : Bool = false;
 	/**
 	/**
 		Set the default `propagate` mode (see `hxd.Event`), default to false.
 		Set the default `propagate` mode (see `hxd.Event`), default to false.
 	**/
 	**/
-	@:s public var propagateEvents : Bool = false;
-	@:s public var enableRightButton : Bool;
+	public var propagateEvents : Bool = false;
+	public var enableRightButton : Bool;
 
 
 	/**
 	/**
 		Is it required to find the best hit point in a complex mesh or any hit possible point will be enough (default = false, faster).
 		Is it required to find the best hit point in a complex mesh or any hit possible point will be enough (default = false, faster).
 	**/
 	**/
-	@:s public var bestMatch : Bool;
+	public var bestMatch : Bool;
 
 
 	var scene : Scene;
 	var scene : Scene;
 	var mouseDownButton : Int = -1;
 	var mouseDownButton : Int = -1;

+ 0 - 13
h3d/scene/Mesh.hx

@@ -79,19 +79,6 @@ class Mesh extends Object {
 		return super.getMaterials(a, recursive);
 		return super.getMaterials(a, recursive);
 	}
 	}
 
 
-	#if (hxbit && !macro && heaps_enable_serialize)
-	override function customSerialize(ctx:hxbit.Serializer) {
-		super.customSerialize(ctx);
-		ctx.addKnownRef(primitive);
-		ctx.addKnownRef(material);
-	}
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		super.customUnserialize(ctx);
-		primitive = ctx.getKnownRef(h3d.prim.Primitive);
-		material = ctx.getKnownRef(h3d.mat.Material);
-	}
-	#end
-
 	override private function onAdd()
 	override private function onAdd()
 	{
 	{
 		super.onAdd();
 		super.onAdd();

+ 0 - 13
h3d/scene/MultiMaterial.hx

@@ -56,17 +56,4 @@ class MultiMaterial extends Mesh {
 		super.draw(ctx);
 		super.draw(ctx);
 	}
 	}
 
 
-	#if (hxbit && !macro && heaps_enable_serialize)
-	override function customSerialize(ctx:hxbit.Serializer) {
-		super.customSerialize(ctx);
-		ctx.addInt(materials.length);
-		for( m in materials ) ctx.addKnownRef(m);
-	}
-
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		super.customUnserialize(ctx);
-		materials = [for( i in 0...ctx.getInt() ) ctx.getKnownRef(h3d.mat.Material)];
-	}
-	#end
-
 }
 }

+ 16 - 86
h3d/scene/Object.hx

@@ -9,7 +9,7 @@ package h3d.scene;
 	public var FAllocated = 0x20;
 	public var FAllocated = 0x20;
 	public var FAlwaysSync = 0x40;
 	public var FAlwaysSync = 0x40;
 	public var FInheritCulled = 0x80;
 	public var FInheritCulled = 0x80;
-	public var FNoSerialize = 0x100;
+	public var FModelRoot = 0x100;
 	public var FIgnoreBounds = 0x200;
 	public var FIgnoreBounds = 0x200;
 	public var FIgnoreCollide = 0x400;
 	public var FIgnoreCollide = 0x400;
 	public var FIgnoreParentTransform = 0x800;
 	public var FIgnoreParentTransform = 0x800;
@@ -30,11 +30,11 @@ package h3d.scene;
 	It can be used to create a virtual container that does not display anything but can contain other objects
 	It can be used to create a virtual container that does not display anything but can contain other objects
 	so the various transforms are inherited to its children.
 	so the various transforms are inherited to its children.
 **/
 **/
-class Object implements hxd.impl.Serializable {
+class Object {
 
 
 	static inline var ROT2RAD = -0.017453292519943295769236907684886;
 	static inline var ROT2RAD = -0.017453292519943295769236907684886;
 
 
-	@:s var flags : ObjectFlags;
+	var flags : ObjectFlags;
 	var children : Array<Object>;
 	var children : Array<Object>;
 
 
 	/**
 	/**
@@ -50,37 +50,37 @@ class Object implements hxd.impl.Serializable {
 	/**
 	/**
 		The name of the object, can be used to retrieve an object within a tree by using `getObjectByName` (default null)
 		The name of the object, can be used to retrieve an object within a tree by using `getObjectByName` (default null)
 	**/
 	**/
-	@:s public var name : Null<String>;
+	public var name : Null<String>;
 
 
 	/**
 	/**
 		The x position of the object relative to its parent.
 		The x position of the object relative to its parent.
 	**/
 	**/
-	@:s public var x(default,set) : Float;
+	public var x(default,set) : Float;
 
 
 	/**
 	/**
 		The y position of the object relative to its parent.
 		The y position of the object relative to its parent.
 	**/
 	**/
-	@:s public var y(default, set) : Float;
+	public var y(default, set) : Float;
 
 
 	/**
 	/**
 		The z position of the object relative to its parent.
 		The z position of the object relative to its parent.
 	**/
 	**/
-	@:s public var z(default, set) : Float;
+	public var z(default, set) : Float;
 
 
 	/**
 	/**
 		The amount of scaling along the X axis of this object (default 1.0)
 		The amount of scaling along the X axis of this object (default 1.0)
 	**/
 	**/
-	@:s public var scaleX(default,set) : Float;
+	public var scaleX(default,set) : Float;
 
 
 	/**
 	/**
 		The amount of scaling along the Y axis of this object (default 1.0)
 		The amount of scaling along the Y axis of this object (default 1.0)
 	**/
 	**/
-	@:s public var scaleY(default, set) : Float;
+	public var scaleY(default, set) : Float;
 
 
 	/**
 	/**
 		The amount of scaling along the Z axis of this object (default 1.0)
 		The amount of scaling along the Z axis of this object (default 1.0)
 	**/
 	**/
-	@:s public var scaleZ(default,set) : Float;
+	public var scaleZ(default,set) : Float;
 
 
 
 
 	/**
 	/**
@@ -93,7 +93,7 @@ class Object implements hxd.impl.Serializable {
 	/**
 	/**
 		Follow a given object or joint as if it was our parent. Ignore defaultTransform when set.
 		Follow a given object or joint as if it was our parent. Ignore defaultTransform when set.
 	**/
 	**/
-	@:s public var follow(default, set) : Object;
+	public var follow(default, set) : Object;
 
 
 	/**
 	/**
 		When follow is set, only follow the position and ignore both scale and rotation.
 		When follow is set, only follow the position and ignore both scale and rotation.
@@ -105,7 +105,7 @@ class Object implements hxd.impl.Serializable {
 		It is used by the animation system.
 		It is used by the animation system.
 	**/
 	**/
 	public var defaultTransform(default, set) : h3d.Matrix;
 	public var defaultTransform(default, set) : h3d.Matrix;
-	@:s public var currentAnimation(default, null) : h3d.anim.Animation;
+	public var currentAnimation(default, null) : h3d.anim.Animation;
 
 
 	/**
 	/**
 		Inform that the object is not to be displayed and his animation doesn't have to be sync. Unlike visible, this doesn't apply to children unless inheritCulled is set to true.
 		Inform that the object is not to be displayed and his animation doesn't have to be sync. Unlike visible, this doesn't apply to children unless inheritCulled is set to true.
@@ -133,9 +133,9 @@ class Object implements hxd.impl.Serializable {
 	public var ignoreCollide(get, set) : Bool;
 	public var ignoreCollide(get, set) : Bool;
 
 
 	/**
 	/**
-		When enabled, the object can be serialized (default : true)
+		Tag the object as a model root
 	**/
 	**/
-	public var allowSerialize(get, set) : Bool;
+	public var modelRoot(get, set) : Bool;
 
 
 	/**
 	/**
 		When enabled, the object will not follow its parent transform
 		When enabled, the object will not follow its parent transform
@@ -196,7 +196,7 @@ class Object implements hxd.impl.Serializable {
 	inline function get_inheritCulled() return flags.has(FInheritCulled);
 	inline function get_inheritCulled() return flags.has(FInheritCulled);
 	inline function get_ignoreBounds() return flags.has(FIgnoreBounds);
 	inline function get_ignoreBounds() return flags.has(FIgnoreBounds);
 	inline function get_ignoreCollide() return flags.has(FIgnoreCollide);
 	inline function get_ignoreCollide() return flags.has(FIgnoreCollide);
-	inline function get_allowSerialize() return !flags.has(FNoSerialize);
+	inline function get_modelRoot() return !flags.has(FModelRoot);
 	inline function get_ignoreParentTransform() return flags.has(FIgnoreParentTransform);
 	inline function get_ignoreParentTransform() return flags.has(FIgnoreParentTransform);
 	inline function get_cullingColliderInherited() return flags.has(FCullingColliderInherited);
 	inline function get_cullingColliderInherited() return flags.has(FCullingColliderInherited);
 	inline function set_posChanged(b) return flags.set(FPosChanged, b || follow != null);
 	inline function set_posChanged(b) return flags.set(FPosChanged, b || follow != null);
@@ -209,7 +209,7 @@ class Object implements hxd.impl.Serializable {
 	inline function set_ignoreBounds(b) return flags.set(FIgnoreBounds, b);
 	inline function set_ignoreBounds(b) return flags.set(FIgnoreBounds, b);
 	inline function set_inheritCulled(b) return flags.set(FInheritCulled, b);
 	inline function set_inheritCulled(b) return flags.set(FInheritCulled, b);
 	inline function set_ignoreCollide(b) return flags.set(FIgnoreCollide, b);
 	inline function set_ignoreCollide(b) return flags.set(FIgnoreCollide, b);
-	inline function set_allowSerialize(b) return !flags.set(FNoSerialize, !b);
+	inline function set_modelRoot(b) return !flags.set(FModelRoot, !b);
 	inline function set_ignoreParentTransform(b) { if( b != ignoreParentTransform ) posChanged = true; return flags.set(FIgnoreParentTransform, b); }
 	inline function set_ignoreParentTransform(b) { if( b != ignoreParentTransform ) posChanged = true; return flags.set(FIgnoreParentTransform, b); }
 	inline function set_cullingColliderInherited(b) return flags.set(FCullingColliderInherited, b);
 	inline function set_cullingColliderInherited(b) return flags.set(FCullingColliderInherited, b);
 
 
@@ -968,74 +968,4 @@ class Object implements hxd.impl.Serializable {
 		return new hxd.impl.ArrayIterator(children);
 		return new hxd.impl.ArrayIterator(children);
 	}
 	}
 
 
-	#if (hxbit && !macro && heaps_enable_serialize)
-	function customSerialize( ctx : hxbit.Serializer ) {
-
-		var children = [for( o in children ) if( o.allowSerialize ) o];
-		ctx.addInt(children.length);
-		for( o in children )
-			ctx.addKnownRef(o);
-		ctx.addDouble(qRot.x);
-		ctx.addDouble(qRot.y);
-		ctx.addDouble(qRot.z);
-		ctx.addDouble(qRot.w);
-
-		ctx.addBool(defaultTransform != null);
-		if( defaultTransform != null ) {
-			ctx.addFloat(defaultTransform._11);
-			ctx.addFloat(defaultTransform._12);
-			ctx.addFloat(defaultTransform._13);
-			ctx.addFloat(defaultTransform._21);
-			ctx.addFloat(defaultTransform._22);
-			ctx.addFloat(defaultTransform._23);
-			ctx.addFloat(defaultTransform._31);
-			ctx.addFloat(defaultTransform._32);
-			ctx.addFloat(defaultTransform._33);
-			ctx.addFloat(defaultTransform._41);
-			ctx.addFloat(defaultTransform._42);
-			ctx.addFloat(defaultTransform._43);
-		}
-
-	}
-
-	static var COUNT = 0;
-
-	function customUnserialize( ctx : hxbit.Serializer ) {
-		children = [for( i in 0...ctx.getInt() ) ctx.getKnownRef(Object)];
-		qRot = new h3d.Quat(ctx.getDouble(), ctx.getDouble(), ctx.getDouble(), ctx.getDouble());
-
-		if( ctx.getBool() ) {
-			defaultTransform = new h3d.Matrix();
-			defaultTransform.loadValues([
-				ctx.getFloat(),
-				ctx.getFloat(),
-				ctx.getFloat(),
-				0,
-				ctx.getFloat(),
-				ctx.getFloat(),
-				ctx.getFloat(),
-				0,
-				ctx.getFloat(),
-				ctx.getFloat(),
-				ctx.getFloat(),
-				0,
-				ctx.getFloat(),
-				ctx.getFloat(),
-				ctx.getFloat(),
-				1
-			]);
-		}
-
-		// init
-		for( c in children )
-			c.parent = this;
-		allocated = false;
-		posChanged = true;
-		absPos = new h3d.Matrix();
-		absPos.identity();
-		if( currentAnimation != null )
-			@:privateAccess currentAnimation.initAndBind(this);
-	}
-	#end
-
 }
 }

+ 0 - 18
h3d/scene/Scene.hx

@@ -452,22 +452,4 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 		}
 		}
 	}
 	}
 
 
-	/**
-		Serialize the scene content as HSD bytes (see hxd.fmt.hsd package). Requires -lib hxbit
-	**/
-	public function serializeScene() : haxe.io.Bytes {
-		#if hxbit
-		var s = new hxd.fmt.hsd.Serializer();
-		return s.saveHSD(this, false, camera);
-		#else
-		throw "You need -lib hxbit to serialize the scene data";
-		#end
-	}
-
-	#if (hxbit && !macro && heaps_enable_serialize)
-	override function customSerialize(ctx:hxbit.Serializer) {
-		throw this + " should not be serialized";
-	}
-	#end
-
 }
 }

+ 2 - 23
h3d/scene/Skin.hx

@@ -1,8 +1,8 @@
 package h3d.scene;
 package h3d.scene;
 
 
 class Joint extends Object {
 class Joint extends Object {
-	@:s public var skin : Skin;
-	@:s public var index : Int;
+	public var skin : Skin;
+	public var index : Int;
 
 
 	public function new(skin, j : h3d.anim.Skin.Joint ) {
 	public function new(skin, j : h3d.anim.Skin.Joint ) {
 		super(null);
 		super(null);
@@ -292,25 +292,4 @@ class Skin extends MultiMaterial {
 		}
 		}
 	}
 	}
 
 
-	#if (hxbit && !macro && heaps_enable_serialize)
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		super.customUnserialize(ctx);
-		var prim = hxd.impl.Api.downcast(primitive, h3d.prim.HMDModel);
-		if( prim == null ) throw "Cannot load skin primitive " + prim;
-		jointsUpdated = true;
-		skinShader = material.mainPass.getShader(h3d.shader.Skin);
-		@:privateAccess {
-			var lib = prim.lib;
-			for( m in lib.header.models )
-				if( lib.header.geometries[m.geometry] == prim.data ) {
-					var skinData = lib.makeSkin(m.skin);
-					skinData.primitive = prim;
-					setSkinData(skinData, false);
-					break;
-				}
-		}
-	}
-	#end
-
-
 }
 }

+ 0 - 7
h3d/scene/World.hx

@@ -680,11 +680,4 @@ class World extends Object {
 		return b;
 		return b;
 	}
 	}
 
 
-	#if (hxbit && !macro && heaps_enable_serialize)
-	override function customUnserialize(ctx:hxbit.Serializer) {
-		super.customUnserialize(ctx);
-		allChunks = [];
-	}
-	#end
-
 }
 }

+ 1 - 1
h3d/scene/pbr/Light.hx

@@ -4,7 +4,7 @@ class Light extends h3d.scene.Light {
 
 
 	var _color : h3d.Vector;
 	var _color : h3d.Vector;
 	var primitive : h3d.prim.Primitive;
 	var primitive : h3d.prim.Primitive;
-	@:s public var power : Float = 1.;
+	public var power : Float = 1.;
 	public var shadows : h3d.pass.Shadows;
 	public var shadows : h3d.pass.Shadows;
 	public var isMainLight = false;
 	public var isMainLight = false;
 	public var occlusionFactor : Float;
 	public var occlusionFactor : Float;

+ 0 - 331
hxd/fmt/hsd/Serializer.hx

@@ -1,331 +0,0 @@
-package hxd.fmt.hsd;
-
-class Serializer extends hxbit.Serializer {
-
-	var version = 0;
-
-	public var resPath : String = h3d.impl.MacroHelper.getResourcesPath();
-	public var modelCache = new h3d.prim.ModelCache();
-	var shaderVarIndex : Int;
-	var shaderUID = 0;
-	var shaderIndexes = new Map<hxsl.Shader,Int>();
-	var cachedShaders = new Array<hxsl.Shader>();
-	var cachedTextures = new Map<Int,h3d.mat.Texture>();
-	var texOutputFormat : hxd.PixelFormat = RGBA;
-
-	function addTexture( t : h3d.mat.Texture ) {
-		if( t == null ) {
-			addInt(0);
-			return true;
-		}
-		addInt(t.id);
-		if( cachedTextures.exists(t.id) )
-			return true;
-		addInt(t.filter.getIndex());
-		addInt(t.mipMap.getIndex());
-		addInt(t.wrap.getIndex());
-		cachedTextures.set(t.id, t);
-		if( t.name != null && hxd.res.Loader.currentInstance.exists(t.name) ) {
-			addInt(1);
-			addString(t.name);
-			return true;
-		}
-		if( t.flags.has(Serialize) ) {
-			addInt(2);
-			addInt(t.width);
-			addInt(t.height);
-			addInt(t.flags.toInt());
-			addInt(t.format.getIndex());
-			var fmt = texOutputFormat;
-			addInt(fmt.getIndex());
-			for( face in 0...(t.flags.has(Cube) ? 6 : 1) ) {
-				var pix = t.capturePixels(face);
-				pix.convert(fmt);
-				addBytesSub(pix.bytes, 0, pix.dataSize);
-			}
-			return true;
-		}
-		var tch = hxd.impl.Api.downcast(t, h3d.mat.TextureChannels);
-		if( tch != null ) {
-			addInt(3);
-			var channels = @:privateAccess tch.channels;
-			addInt(t.width);
-			addInt(t.height);
-			addInt(t.flags.toInt());
-			addInt(t.format.getIndex());
-			for( i in 0...4 ) {
-				var c = channels[i];
-				if( c == null ) {
-					addString(null);
-					continue;
-				}
-				if( c.r == null )
-					return false;
-				addString(c.r.entry.path);
-				addInt(c.c.toInt());
-			}
-			return true;
-		}
-		return false;
-	}
-
-	function getTexture() {
-		var tid = getInt();
-		if( tid == 0 )
-			return null;
-		var t = cachedTextures.get(tid);
-		if( t != null )
-			return t;
-		var filter = h3d.mat.Data.Filter.createByIndex(getInt());
-		var mipmap = h3d.mat.Data.MipMap.createByIndex(getInt());
-		var wrap = h3d.mat.Data.Wrap.createByIndex(getInt());
-		var kind = getInt();
-		switch( kind ) {
-		case 1:
-			t = resolveTexture(getString());
-		case 2,3:
-			var width = getInt(), height = getInt();
-			var flags : haxe.EnumFlags<h3d.mat.Data.TextureFlags> = haxe.EnumFlags.ofInt(getInt());
-			var format = h3d.mat.Data.TextureFormat.createByIndex(getInt());
-			var flags = [for( f in h3d.mat.Data.TextureFlags.createAll() ) if( flags.has(f) ) f];
-			if( kind == 2 ) {
-				var pixFormat = h3d.mat.Data.TextureFormat.createByIndex(getInt());
-				t = new h3d.mat.Texture(width, height, flags, format);
-				for( face in 0...(t.flags.has(Cube)?6:1) )
-					t.uploadPixels(new hxd.Pixels(width, height, getBytes(), pixFormat), 0, face);
-			} else {
-				var ct = new h3d.mat.TextureChannels(width, height, flags, format);
-				ct.allowAsync = false;
-				for( i in 0...4 ) {
-					var resPath = getString();
-					if( resPath == null ) continue;
-					var c = hxd.Pixels.Channel.fromInt(getInt());
-					ct.setResource(hxd.Pixels.Channel.fromInt(i), hxd.res.Loader.currentInstance.load(resPath).toImage(), c);
-				}
-				t = ct;
-			}
-		default:
-			throw "assert";
-		}
-		t.filter = filter;
-		t.mipMap = mipmap;
-		t.wrap = wrap;
-		cachedTextures.set(tid, t);
-		return t;
-	}
-
-	function resolveTexture( path : String ) {
-		return hxd.res.Loader.currentInstance.load(path).toTexture();
-	}
-
-	public function loadHMD( path : String ) {
-		return modelCache.loadLibrary(hxd.res.Loader.currentInstance.load(path).toModel());
-	}
-
-	public function addShader( s : hxsl.Shader ) {
-		if( s == null ) {
-			addInt(0);
-			return;
-		}
-		var id = shaderIndexes.get(s);
-		if( id != null ) {
-			addInt(id);
-			return;
-		}
-		id = ++shaderUID;
-		shaderIndexes.set(s, id);
-		addInt(id);
-		addString(Type.getClassName(Type.getClass(s)));
-		shaderVarIndex = 0;
-		for( v in @:privateAccess s.shader.data.vars )
-			addShaderVar(v, s);
-	}
-
-	function loadShader( name : String ) : hxsl.Shader {
-		return null;
-	}
-
-	public function getShader() {
-		var id = getInt();
-		if( id == 0 )
-			return null;
-		var s = cachedShaders[id];
-		if( s != null )
-			return s;
-		var sname = getString();
-		var cl : Class<hxsl.Shader> = cast Type.resolveClass(sname);
-		if( cl == null ) {
-			s = loadShader(sname);
-			if( s == null )
-				throw "Missing shader " + sname;
-		} else
-			s = Type.createEmptyInstance(cl);
-		@:privateAccess s.initialize();
-		var sdyn = hxd.impl.Api.downcast(s, hxsl.DynamicShader);
-		for( v in @:privateAccess s.shader.data.vars ) {
-			if( !canSerializeVar(v) ) continue;
-			var val : Dynamic = getShaderVar(v, s);
-			if( sdyn != null )
-				sdyn.setParamValue(v, val);
-			else
-				Reflect.setField(s, v.name+"__", val);
-		}
-		cachedShaders[id] = s;
-		return s;
-	}
-
-	function canSerializeVar( v : hxsl.Ast.TVar ) {
-		return v.kind == Param && (v.qualifiers == null || v.qualifiers.indexOf(Ignore) < 0);
-	}
-
-	function addShaderVar( v : hxsl.Ast.TVar, s : hxsl.Shader ) {
-		if( v.kind != Param )
-			return;
-		switch( v.type ) {
-		case TStruct(vl):
-			for( v in vl )
-				addShaderVar(v, s);
-			return;
-		default:
-		}
-		if( !canSerializeVar(v) ) {
-			shaderVarIndex++;
-			return;
-		}
-		var val : Dynamic = s.getParamValue(shaderVarIndex++);
-		switch( v.type ) {
-		case TBool:
-			addBool(val);
-		case TInt:
-			addInt(val);
-		case TFloat:
-			addFloat(val);
-		case TVec(n, VFloat):
-			var v : h3d.Vector = val;
-			addFloat(v.x);
-			addFloat(v.y);
-			if( n >= 3 ) addFloat(v.z);
-			if( n >= 4 ) addFloat(v.w);
-		case TSampler2D, TSamplerCube:
-			if( !addTexture(val) )
-				throw "Cannot serialize unnamed texture " + s+"."+v.name+" = "+val;
-		default:
-			throw "Cannot serialize macro var " + v.name+":"+hxsl.Ast.Tools.toString(v.type)+" in "+s;
-		}
-	}
-
-	function getShaderVar( v : hxsl.Ast.TVar, s : hxsl.Shader ) : Dynamic {
-		switch( v.type ) {
-		case TStruct(vl):
-			var obj = {};
-			for( v in vl ) {
-				if( !canSerializeVar(v) ) continue;
-				Reflect.setField(obj, v.name, getShaderVar(v, s));
-			}
-			return obj;
-		default:
-		}
-		switch( v.type ) {
-		case TBool:
-			return getBool();
-		case TFloat:
-			return getFloat();
-		case TInt:
-			return getInt();
-		case TVec(n, VFloat):
-			var v = new h3d.Vector(getFloat(), getFloat());
-			if( n >= 3 ) v.z = getFloat();
-			if( n >= 4 ) v.w = getFloat();
-			return v;
-		case TSampler2D, TSamplerCube:
-			return getTexture();
-		default:
-			throw "Cannot unserialize macro var " + v.name+":"+hxsl.Ast.Tools.toString(v.type);
-		}
-	}
-
-	function initHSDPaths( resPath : String, projectPath : String ) {
-		this.resPath = resPath;
-	}
-
-	public function loadAnimation( resPath : String ) {
-		return loadHMD(resPath).loadAnimation();
-	}
-
-	public function loadHSD( bytes ) {
-		setInput(bytes, 0);
-		if( getString() != "HSD" )
-			throw "Invalid HSD file";
-		version = getInt();
-		beginLoad(bytes, inPos);
-		initHSDPaths(getString(), getString());
-		var objs = [];
-		for( i in 0...getInt() ) {
-			var obj : h3d.scene.Object = cast getAnyRef();
-			objs.push(obj);
-		}
-		for( o in objs )
-			for( m in o.getMeshes() )
-				h3d.mat.MaterialSetup.current.customMeshInit(m);
-
-		var camera = null;
-		if( getBool() ) {
-			camera = new h3d.Camera();
-			camera.pos.set(getFloat(), getFloat(), getFloat());
-			camera.target.set(getFloat(), getFloat(), getFloat());
-			camera.up.set(getFloat(), getFloat(), getFloat());
-			camera.fovY = getFloat();
-			camera.zNear = getFloat();
-			camera.zFar = getFloat();
-			camera.zoom = getFloat();
-			camera.update();
-		}
-
-		endLoad();
-		return { content : objs, camera : camera };
-	}
-
-	public function saveHSD( obj : h3d.scene.Object, includeRoot : Bool, ?camera : h3d.Camera ) {
-		begin();
-		addString("HSD");
-		addInt(version); // version
-
-		var pos = out.length;
-		usedClasses = [];
-		addString(resPath);
-		#if sys
-		addString(Sys.getCwd());
-		#else
-		addString(null);
-		#end
-
-		var objs = includeRoot ? [obj] : [for( o in obj ) if( o.allowSerialize ) o];
-		addInt(objs.length);
-		#if heaps_enable_serialize
-		for( o in objs )
-			addAnyRef(o);
-		#else
-		throw "HSD support requires -D heaps_enable_serialize";
-		#end
-
-		addBool(camera != null);
-		if( camera != null ) {
-			addFloat(camera.pos.x);
-			addFloat(camera.pos.y);
-			addFloat(camera.pos.z);
-			addFloat(camera.target.x);
-			addFloat(camera.target.y);
-			addFloat(camera.target.z);
-			addFloat(camera.up.x);
-			addFloat(camera.up.y);
-			addFloat(camera.up.z);
-			addFloat(camera.fovY);
-			addFloat(camera.zNear);
-			addFloat(camera.zFar);
-			addFloat(camera.zoom);
-		}
-
-		return endSave(pos);
-	}
-
-}

+ 0 - 17
hxd/impl/Serializable.hx

@@ -1,17 +0,0 @@
-package hxd.impl;
-
-#if (!hxbit || macro || !heaps_enable_serialize)
-
-// disable serialization support
-private interface NoSerializeSupport {
-}
-typedef Serializable = NoSerializeSupport;
-typedef StructSerializable = NoSerializeSupport;
-
-#else
-
-typedef Serializable = hxbit.Serializable;
-typedef StructSerializable = hxbit.StructSerializable;
-
-#end
-