Bläddra i källkod

moved VEC4_DATA from MeshBatch to BufferFormat

Nicolas Cannasse 1 år sedan
förälder
incheckning
38680e608b
2 ändrade filer med 6 tillägg och 2 borttagningar
  1. 1 2
      h3d/scene/MeshBatch.hx
  2. 5 0
      hxd/BufferFormat.hx

+ 1 - 2
h3d/scene/MeshBatch.hx

@@ -328,7 +328,6 @@ class MeshBatch extends MultiMaterial {
 		}
 	}
 
-	static var VEC4_FMT = hxd.BufferFormat.make([{ name : "data", type : DVec4 }]);
 	static var BATCH_START_FMT = hxd.BufferFormat.make([{ name : "Batch_Start", type : DFloat }]);
 
 	override function sync(ctx:RenderContext) {
@@ -347,7 +346,7 @@ class MeshBatch extends MultiMaterial {
 				if( count > p.maxInstance )
 					count = p.maxInstance;
 				if( buf == null || buf.isDisposed() ) {
-					buf = alloc.allocBuffer(MAX_BUFFER_ELEMENTS,VEC4_FMT,UniformDynamic);
+					buf = alloc.allocBuffer(MAX_BUFFER_ELEMENTS,hxd.BufferFormat.VEC4_DATA,UniformDynamic);
 					p.buffers[index] = buf;
 					upload = true;
 				}

+ 5 - 0
hxd/BufferFormat.hx

@@ -223,6 +223,7 @@ class BufferFormat {
 	public static var POS3D_UV(get,null) : BufferFormat;
 	public static var POS3D_NORMAL_UV(get,null) : BufferFormat;
 	public static var POS3D_NORMAL_UV_RGBA(get,null) : BufferFormat;
+	public static var VEC4_DATA(get,null) : BufferFormat;
 
 	static inline function get_H2D() return XY_UV_RGBA;
 	static function get_XY_UV_RGBA() {
@@ -253,6 +254,10 @@ class BufferFormat {
 		if( POS3D_UV == null ) POS3D_UV = make([{ name : "position", type : DVec3 },{ name : "uv", type : DVec2 }]);
 		return POS3D_UV;
 	}
+	static function get_VEC4_DATA() {
+		if( VEC4_DATA == null ) VEC4_DATA = hxd.BufferFormat.make([{ name : "data", type : DVec4 }]);
+		return VEC4_DATA;
+	}
 
 	static var ALL_FORMATS = new Map<String,Array<BufferFormat>>();
 	public static function make( inputs : Array<BufferInput> ) {