Nicolas Cannasse %!s(int64=11) %!d(string=hai) anos
pai
achega
570c24664d
Modificáronse 7 ficheiros con 0 adicións e 1010 borrados
  1. 0 91
      doc/Render.hx
  2. 0 306
      doc/Shaders.hx
  3. 0 211
      tools/xbx/XBXMake.hx
  4. 0 4
      tools/xbx/XBXMake.hxml
  5. 0 52
      tools/xbx/XBXMake.hxproj
  6. 0 346
      tools/xbx/boneTest3DS.fbx
  7. BIN=BIN
      tools/xbx/boneTest3DS.xbx

+ 0 - 91
doc/Render.hx

@@ -1,91 +0,0 @@
-// shader setup:
-	
-if( globals.constModified || shader.constModified ) {
-	shader.syncGlobalConsts(globals);
-	// will get/build an instance based on globals + const bits
-	// the instance is the eval'd version of the shader and has an unique ID
-}
-instances.push(shader.instance);
-
-// get/build a linked shader based on the unique instance identifiers and outputs
-// make sure that it's unique (use md5(toString) to prevent dups)
-var linked = getLinkedVersion(instances, ["output.pos", "output.color"]);
-
-shaders.sort(sortByLinkedId)
-for( s in linked ) {
-	if( s != prevId ) {
-		selectShader(s);
-		uploadParams(s.buildGlobals(globals));
-	}
-	// handle params and per-object globals (modelView, modelViewInv)
-	uploadParams(s.buildParams(globals));
-	render();g
-}
-
-// CHECK HOW RENDER PASS ARE DONE
-
-var passes : Map< String, Array<ObjectPass> > = collecObjectPasses();
-for( m in allPasses ) {
-	var objs = passes.get(m.name);
-	m.render(objs);
-}
-
-function renderPass() {
-	for( op in objectPasses ) {
-		op.pass.setup(...);
-		op.pass.assemble();
-	}
-	objectPass.sort(sortByShaderID);
-	beginPass();
-	for( op in objectPasses ) {
-		engine.selectPass(op.pass);
-		op.primitive.render();
-	}
-	endPass();
-}
-
-// ----------------------------
-// on mesh, passes are referenced by their name, not by a concrete object (decouple local setup from global one)
-
-var m = new Mesh(prim).material;
-
-(color white by default)
-m.texture = mytexture; // add the TextureShader on pass[0] if not already added
-m.addShader(new TextureMap(tex2)).additive = true; // second texture with additive
-m.castShadows = true; // add/remove the "shadowMap" pass with DepthShader
-m.receiveShadows = false; //add/remove the ShadowShader on pass[0]
-
-m.blendMode = Normal | Alpha | Additive
-	will set m.pass[0].name to "default" | "alpha" | "additive" and blendSrc/blendDst as well
-	-> blend / depth / culling / color are now in Pass properties, not in Material
-	
-mesh.addPass("outline",true/*inherit*/).addShader(new OutlineShader({ params }));
-mesh.removePass("outline");
-
-// on Scene, global setup as Array of passes
-
-var passes = scene.passes;
-passes.push(new ShadowMapPass("shadowMap",2048,...));
-
-Pass :
-	name : String; // a quel pass il s'execute
-	parentPass : inherit des modifiers (null si on ne veux pas garder les transforms par exemple)
-	shaders : Array<Shader> // this pass modifier
-	blendSrc/Dst
-	depthTest/Write
-	culling
-	colorMask
-
-ObjectPass:
-	pass : Pass (params already set)
-	prim : Primitive
-	obj : Object (for absPos, invAbsPos and error reporting)
-
-how are "globals" injected ?
-	before a pass is rendered, each pass is setup() using the current pass globals + the object specific globals
-	--> each pass can reinterpret the globals (eg : ShadowMap uses Light instead of Camera)
-	it is then assembled at pass rendering time (not before)
-	--> we need to know the pass output variable, global list and output selection to do so
-
-
-	

+ 0 - 306
doc/Shaders.hx

@@ -1,306 +0,0 @@
-
-//
-//  Resolve dependencies :
-// 		Given a Proto + X shader modifiers, build a complete shader and optimize it
-//		TODO : where to insert changes made by modifiers ?
-//		it seems necessary to build a code tree with dependencies in order to allow code permutation
-//		it is absolutely necessary to treat each struct field as a single variable (was not in HxSL)
-	
-Steps :
-	A) apply conditionals / reduce
-	B) calculate per-function dependencies
-	C) resolve order
-	D) eliminate code based on final pass requirement (output.color or another var)
-	E) calculate used vars and classify them
-
-	
-Variable types:
-
-	@global : no per-shader but per-pass (read-only)
-	@param : per-object parameter (read - only)
-	@input : vertex input
-	@var (default) : variable available between shaders (tracked for dependency)
-
-	Qualifiers:
-		
-	@private : for a @var, hide it from other shaders
-	@const : qualifier for param (default) or global. Mean that the value is eliminated at compilation
-
-Proto:
-	
-	// globals are injected by passes, they are not local to the per-shader-object. They are thus accessible in sub passes as well
-	@global var camera : {
-		var view : Matrix;
-		var proj : Matrix;
-		var projDiag : Float3; // [_11,_22,_33]
-		var viewProj : Matrix;
-		var inverseViewProj : Matrix;
-		@var var dir : Float3; // allow mix of variable types in structure (each variable is independent anyway)
-	};
-
-	@global var global : {
-		var time : Float;
-		var modelView : Matrix;
-		// ... other available globals in BasePass
-	};
-	
-	@input var input : {
-		var position : Float3;
-		var normal : Float3;
-	};
-	
-	var output : {
-		var position : Float4; // written in vertex
-		var color : Float4; // written in fragment
-	};
-	
-	// vars are always exported
-	
-	var transformedPosition : Float3;
-	var transformedNormal : Float3;
-	var projectedPosition : Float4;
-	var pixelColor : Float4;
-	
-	// each __init__ expr is out of order dependency-based
-	function __init__() {
-		transformedPosition = input.position * global.modelView;
-		projectedPosition = float4(transformedPosition, 1) * camera.viewProj;
-		transformedNormal = input.normal * global.modelView.m33;
-		camera.dir = (camera.position - transformedPosition).normalize();
-		pixelColor = color;
-	}
-	
-	function vertex() {
-		output.position = projectedPosition;
-	}
-	
-	function fragment() {
-		output.color = pixelColor;
-	}
-	
-	
-VertexColor
-	
-	@input var input : {
-		var color : Float3;
-	};
-	
-	var pixelColor : Float4;
-	
-	function vertex() {
-		vertexColor = input.color;
-	}
-	
-	function fragment() {
-		pixelColor.rgb *= vertexColor;
-	}
-
-
-TextureMaterial
-
-	// will add extra required fields to input
-	@input var input : {
-		var uv : Float2;
-	};
-	
-	@const var additive : Bool;
-	@const var killAlpha : Bool;
-	@param var killAlphaThreshold : Float;
-	
-	@param var texture : Texture;
-	var calculatedUV : Float2;
-	var pixelColor : Float4;
-	
-	function vertex() {
-		calculatedUV = input.uv;
-	}
-	
-	function fragment() {
-		var c = texture.get(calculatedUV);
-		if( killAlpha ) kill(c.a - killAlphaThreshold); // in multipass, we will have to specify if we want to keep the kill's or not
-		if( additive )
-			pixelColor += c;
-		else
-			pixelColor *= c;
-	}
-
-	// ajouter plusieurs TextureMaterial permet de faire du multiTexturing (à partir des même UV)
-
-AnimatedUV
-
-	var calculatedUV : Float2;
-	@global("global.time") var globalTime : Float;
-	@param var animationUV : Float2;
-	
-	function vertex() {
-		calculatedUV += animationUV * globalTime;
-	}
-
-	
-LightSystem:
-
-	// the light system is set by the pass setup, even if it's potentially per-object, it's still a global
-	@global var light : {
-		@const var perPixel : Bool;
-		var ambient : Float3;
-		var dirs : Array<{ dir : Float3, color : Float3 }>;
-		var points : Array<{ pos : Float3, color : Float3, att : Float3 }>;
-	};
-	
-	var transformedNormal : Float3; // will be tagged as read in either vertex or fragment depending on conditional
-	
-	@private var color : Float3; // will be tagged as written in vertex and read in fragment if !perPixel, or unused either
-	
-	var pixelColor : Float4; // will be tagged as read+written in fragment
-
-	function calcLight() {
-		var col = light.ambient;
-		var tn = transformedNormal.normalize();
-		for( d in light.dirs )
-			col += d.color * tn.dot(-d.dir).max(0);
-		for( p in light.points ) {
-			var d = transformedPosition - p.pos;
-			var dist2 = d.dot(d);
-			var dist = dist2.sqt();
-			col += p.color * (tn.dot(d).max(0) / (p.att.x * dist + p.att.y * dist2 + p.att.z * dist2 * dist));
-		}
-		return col;
-	}
-	
-	function vertex() {
-		if( !light.perPixel ) color = calcLight();
-	}
-	
-	function fragment() {
-		if( light.perPixel )
-			pixelColor.rgb *= calcLight();
-		else
-			pixelColor.rgb *= color;
-	}
-	
-	// DEPENDENCY:
-		Vertex:
-		READ transformedNormal   |-> must be inserted after all vertex that write transformNormals have been done
-		READ transformedPosition |
-		WRITE lightColor -> must be inserted before any vertex that reads light color
-		Fragment:
-		READ lightColor -> must be inserted after all fragments that write these two
-		READ+WRITE pixelColor -> must be inserted after it's been written first, but then keep the shader order
-		
-	CONFLICT if a program read lightColor and write transformNormal (unresolved cycle)
-	
-	CONFLICT if a program inserted after WRITE both lightColor and pixelColor:
-		writing lightColor will put it before, but since it also write pixelColor it should be after to enforce evaluation order
-		the user should then put it before
-
-	
-Outline
-
-	// Param are always local
-	@param var color : Float4;
-	@param var power : Float;
-	@param var size : Float;
-	
-	var camera : {
-		var projDiag : Float3;
-		var dir : Float3;
-	};
-	var transformedNormal : Float3;
-
-	function vertex() {
-		transformedPosition.xy += transformedNormal.xy * camera.projDiag.xy * size;
-	}
-	
-	function fragment() {
-		var e = 1 - transformedNormal.normalize().dot(camera.dir.normalize());
-		output.color = color * e.pow(power);
-	}
-	
-Skin
-
-	@input var input : {
-		pos : Float3,
-		normal : Float3,
-		weights : Float3,
-		indexes : Int,
-	};
-	
-	var transformedPosition : Float3;
-	var transformedNormal : Float3;
-	
-	function vertex() {
-		var p = input.pos, n = input.normal;
-		transformedPosition = p * input.weights.x * skinMatrixes[input.indexes.x * (255 * 3)] + p * input.weights.y * skinMatrixes[input.indexes.y * (255 * 3)] + p * input.weights.z * skinMatrixes[input.indexes.z * (255 * 3)];
-		transformedNormal = n * input.weights.x * skinMatrixes[input.indexes.x * (255 * 3)].m33 + n * input.weights.y * skinMatrixes[input.indexes.y * (255 * 3)].m33 + n * input.weights.z * skinMatrixes[input.indexes.z * (255 * 3)].m33;
-	}
-	
-	// will write TP/TN, hence disabling proto init
-
-ApplyShadow
-
-	@global var shadow : {
-		var map : Texture;
-		var color : Float3;
-		var power : Float;
-		var lightProj : Matrix;
-		var lightCenter : Matrix;
-	};
-
-	// Nullable params, allow to check them in shaders. Will create a isNull Const automatically
-	// actually use the global values unless object-specific local values are defined
-	var shadowColor : Param<Null<Float3>>;
-	var shadowPower : Param<Null<Float>>;
-
-	var pixelColor : Float4;
-
-	@:private var tshadowPos : Float3;
-	
-	function vertex() {
-		tshadowPos = float4(transformedPosition,1) * shadow.lightProj * shadow.lightCenter;
-	}
-	
-	function fragment() {
-		var s = exp( (shadowPower == null ? shadow.power : shadowPower) * (tshadowPos.z - shadow.map.get(tshadowPos.xy).dot([1, 1 / 255, 1 / (255 * 255), 1 / (255 * 255 * 255)]))).sat();
-		pixelColor.rgb *= (1 - s) * (shadowColor == null ? shadow.color : shadowColor) + s.xxx;
-	}
-
-DepthMap
-
-	@global var depthDelta : Float;
-	@:private var distance : Float;
-	
-	// the pass setup will have to declare that it will write distanceColor to its rendertarget
-	var depthColor : Float4;
-
-	function vertex() {
-		distance = projectedPosition.z / projectedPosition.w + depthDelta;
-	}
-	
-	function fragment() {
-		var color : Float4 = (distance.xxxx * [1,255,255*255,255*255*255]).frac();
-		depthColor = color - color.yzww * [1 / 255, 1 / 255, 1 / 255, 0];
-	}
-
-DistanceMap
-
-	@global var distance : {
-		var center : Float3;
-		var scale : Float;
-		var power : Float;
-	};
-
-	@private var dist : Float3;
-	
-	// the pass will have to declare that it will write distanceColor to its rendertarget
-	var distanceColor : Float4;
-
-	function vertex() {
-		dist = (transformedPosition - center).abs();
-	}
-	
-	function fragment() {
-		var d = (dist.length() * scale).pow(power);
-		var color : Float4 = (d.xxxx * [1,255,255*255,255*255*255]).frac();
-		distanceColor = color - color.yzww * [1 / 255, 1 / 255, 1 / 255, 0];
-	}
-

+ 0 - 211
tools/xbx/XBXMake.hx

@@ -1,211 +0,0 @@
-import h3d.fbx.*;
-import h3d.fbx.Data;
-
-class XBXMake
-{
-	var inFile : String;
-	var outputFile : Null<String>;
-	var verbose:Bool;
-	var nozip:Bool;
-	var doTest:Bool;
-	function new()
-	{
-		
-	}
-
-	function usage() {
-		neko.Lib.println( "neko XBXMake.n <file> [-o|--output <file> ] [-z] ");
-		neko.Lib.println( "writes FBX <file> in XBX which is basically a stripped binary version of it." );
-		neko.Lib.println( "--no-zip impeach terminal fiel for compression (useful for debug)" );
-	}
-	
-	public function make(prm:Array<String>)
-	{
-		var params = prm;
-
-		for ( a in 0...params.length )
-		{
-			var arg = params[a];
-			if (null == arg) continue;
-			
-			switch(arg)
-			{
-				case "--usage", "/?":
-					usage();
-					return;
-					
-				case "-o", "--output":
-					outputFile = params[a + 1];
-					params.remove( arg );
-					params.remove( params[a + 1] );
-		
-				case "--no-zip": nozip = true;
-				case "--test": doTest = true;
-				case "-v", "--verbose":verbose=true;
-				default:
-					inFile = arg;
-			}
-		}
-		
-		if( inFile == null ) {
-			usage();
-			return;
-		}
-		
-		var idx = inFile.toLowerCase().lastIndexOf(".fbx");
-		
-		if ( idx < 0 )
-			throw inFile + " is not an Fbx file";
-		
-		if ( outputFile == null)
-			outputFile = inFile.substr(0, idx) + ".xbx";
-		
-		var f = sys.io.File.read( inFile, true);
-		var fbx = h3d.fbx.Parser.parse( f.readAll().toString() );
-		f.close();
-		
-		var bout = new haxe.io.BytesOutput();
-		var writer = new h3d.fbx.XBXWriter( bout );
-		writer.write(fbx);
-	
-		var b = bout.getBytes();
-		
-		{
-			var entry : format.zip.Data.Entry =
-			{
-				fileName:"fbx_root",
-				fileSize : b.length,
-				fileTime:Date.now(),
-				compressed:false,
-				dataSize:0,
-				data:b,
-				crc32:haxe.crypto.Crc32.make(b),
-				extraFields:new List(),
-			}
-			
-			var zb = new haxe.io.BytesOutput();
-			var zw = new format.zip.Writer(zb);
-			var  nl = new List();
-			
-			if( !nozip )
-				format.zip.Tools.compress( entry, 9);
-				
-			nl.add( entry);
-			zw.write(nl);
-			var file = sys.io.File.write( outputFile, true);
-			file.write( zb.getBytes() );
-			file.flush();
-			file.close();
-			
-			if ( doTest )
-			{
-				var f = sys.io.File.read( outputFile, true);
-				var zr = new format.zip.Reader( f);
-				var entries = zr.read();
-				var p = entries.first();
-				
-				if ( p.compressed )
-					format.zip.Tools.uncompress( p );
-
-				var buf = p.data;
-
-				var inp = new haxe.io.BytesInput( buf );
-				var reader = new XBXReader( inp );
-				
-				function explore(n:h3d.fbx.Data.FbxNode)
-				{
-					trace( n.name );
-					trace( n.props);
-					for (n in n.childs)
-						explore(n);
-				}
-				
-				var rfbx = reader.read();
-				
-				function cmp(t0:FbxNode,t1:FbxNode)
-				{
-					if ( t0.name != t1.name)
-					{
-						trace( t0.name + " != " + t1.name );
-						return false;
-					}
-					
-					if ( t0.childs.length != t1.childs.length) {
-						trace( t0.name + " has not same child num to its counterpart" );
-						return false;
-					}
-					
-					for ( idx in 0...t0.childs.length)
-					{
-						if ( !cmp( t0.childs[idx], t1.childs[idx] ))
-						{
-							return false;
-						}
-					}
-					
-					if ( t0.props.length != t1.props.length) {
-						trace( t0.name + " has not same prop num to its counterpart" );
-					}
-					
-					for ( idx in 0...t0.props.length)
-					{
-						var p0 = t0.props[idx];
-						var p1 = t1.props[idx];
-						
-						var msg = function(s) trace( "prop (" + 	idx+") of " + t0.name + " has not same value as its counterpart "+s );
-						
-						switch( p0 )
-						{
-							case PInt(v0): switch(p1) { case PInt(v1): if (v0 != v1) { msg( v0 + "<>" + v1); return false; }  default: msg("type err PInt"); return false; };
-							case PFloat(v0): switch(p1) { case PFloat(v1): if (v0 != v1) { msg( v0 + "<>" + v1); return false; }  default: msg("type err PFloat"); return false; };
-							case PString(v0): switch(p1) { case PString(v1): if (v0 != v1) { msg( v0 + "<>" + v1); return false; }  default: msg("type err PString"); return false; };
-							case PIdent(v0): switch(p1) { case PIdent(v1): if (v0 != v1) { msg( v0 + "<>" + v1); return false; }  default: msg("type err PIdent"); return false; };
-							
-							case PInts(v0):
-								switch(p1) {
-									default: msg("type err PInts"); return false;
-									case PInts(v1):
-										for ( idx in 0...v0.length)
-											if ( v0[idx] != v1[idx])
-											{
-												msg("mismtched value in ints at index " + idx + " " + v0[idx] + "<>" + v1[idx]);
-												return false;
-											}
-								}
-								
-							case PFloats(v0):
-								switch(p1) {
-									default: msg("type err PFloats "); return false;
-									case PFloats(v1):
-										for ( idx in 0...v0.length)
-											if ( Math.abs( v0[idx] - v1[idx]) > 1e-3 )
-											{
-												msg("mismtched value in floats at index " + idx + " " + v0[idx] + "<>" + v1[idx]);
-												return false;
-											}
-								}
-						}
-						
-					}
-				
-					
-						
-					return true;
-				}
-			
-				cmp( fbx, rfbx);
-			}
-		}
-	}
-	
-	
-	public static function main()
-	{
-		new XBXMake().make(  Sys.args().copy() );
-	}
-	
-	public static function test()
-	{
-		
-	}
-}

+ 0 - 4
tools/xbx/XBXMake.hxml

@@ -1,4 +0,0 @@
--cp ../..
--neko XBXMake.n
--main XBXMake
--lib format

+ 0 - 52
tools/xbx/XBXMake.hxproj

@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project version="2">
-  <!-- Output SWF options -->
-  <output>
-    <movie outputType="Application" />
-    <movie input="" />
-    <movie path="XBXMake.n" />
-    <movie fps="0" />
-    <movie width="0" />
-    <movie height="0" />
-    <movie version="1" />
-    <movie minorVersion="0" />
-    <movie platform="Neko" />
-    <movie background="#FFFFFF" />
-  </output>
-  <!-- Other classes to be compiled into your SWF -->
-  <classpaths>
-    <class path="..\.." />
-  </classpaths>
-  <!-- Build options -->
-  <build>
-    <option directives="" />
-    <option flashStrict="False" />
-    <option mainClass="XBXMake" />
-    <option enabledebug="False" />
-    <option additional="-lib format" />
-  </build>
-  <!-- haxelib libraries -->
-  <haxelib>
-    <!-- example: <library name="..." /> -->
-  </haxelib>
-  <!-- Class files to compile (other referenced classes will automatically be included) -->
-  <compileTargets>
-    <compile path="src\Main.hx" />
-  </compileTargets>
-  <!-- Paths to exclude from the Project Explorer tree -->
-  <hiddenPaths>
-    <!-- example: <hidden path="..." /> -->
-  </hiddenPaths>
-  <!-- Executed before build -->
-  <preBuildCommand />
-  <!-- Executed after build -->
-  <postBuildCommand alwaysRun="False" />
-  <!-- Other project options -->
-  <options>
-    <option showHiddenPaths="False" />
-    <option testMovie="Custom" />
-    <option testMovieCommand="run.bat" />
-  </options>
-  <!-- Plugin storage -->
-  <storage />
-</project>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 346
tools/xbx/boneTest3DS.fbx


BIN=BIN
tools/xbx/boneTest3DS.xbx


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio