minib3dext command help
BlitzMax Forums/MiniB3D Module/minib3dext command help| 
 | ||
| I am currently experimenting with minib3dext041.  It is pretty neat stuff.  I am however struggling with the lack of clear documentation.  I have a few questions regarding some commands.  I am currently struggling with what the heck these ones do: SetAD1 SetAD2 SetAD3 SetAD4 SetAF1 SetAF2 SetAF3 SetAF4 SetAS1 SetAS2 SetAS3 SetAS4 SetM2 SetM3 SetM4 SetUF1 SetUF2 SetUF3 SetUF4 SetUI1 SetUI2 SetUI3 SetUI4 I know its something to do with shaders, meshes, or brushes... er something. Any hints would be appreciated. Currently the best documentation I can find on minib3dext041 is here: http://www.minib3d.com/doku.php?id=start:commands If there is more in-depth documentation laying around, could someone please let me know? Thank you! | 
| 
 | ||
| Hi, these commands belong to the shader pipeline and are for communicating with the shader itself. In a shader you can have user defined variables, like float values or textures etc. With these commands you can set these values from within your application. the last number behind these commands is related to the number of dimensions the shader variable has. UF = Uniform Float UI = uniform int M = Matrix (2*2,3*3,4*4) AF = attribute Float etc. The new Shader system is much clearer and easier to use. But because I have new job which is currently very time consuming i have trouble to get the new version ready. At the moment I try to glue everything together and build a ready version to release next weekend. here is a simple shader exsample how it can be done with the new version: 
Type TSimpleBumpMap Extends TMaterialPlugin
	
	Field shader:TShaderMaterial
	Field light:Tlight
	
	Method TurnOn(surf:TSurface = Null) 	
		shader.TurnOn(surf)
	End Method 
	
	Method TurnOff()
		shader.TurnOff()
	End Method
	
	Method UpdateData() 
		If Light Then shader.SetParameter3F("lightpos" , EntityX(Light) , EntityY(light) , EntityZ(Light) ) 
	End Method
	
	Method CreateSimpleBumpMap:TSimpleBumpMap() 
		shader = New TShaderMaterial.CreateShaderMaterial("BumpMap")
		shader.AddShader("bump.vert" , "bump.frag") 
		shader.ProgramAttriBegin()
		shader.SetParameter1F("invRadius",0.001)
		shader.SetParameter3F("vTangent" , 1.0 , .0 , .0)
		shader.SetParameter1F("scale",1.0)
		shader.ProgramAttriEnd()
		Return Self
	End Method
	
	Method SetColorMap(tex:TTexture)
		shader.ProgramAttriBegin()
		shader.AddSampler2D("colorMap",0,tex)
		shader.ProgramAttriEnd()
	End Method
	
	Method SetNormalMap(tex:TTexture)
		shader.ProgramAttriBegin()
		shader.AddSampler2D("normalMap",1,tex)
		shader.ProgramAttriEnd()
	End Method
	
	Method SetLightRange(Range:Float)
		shader.ProgramAttriBegin()
		shader.SetParameter1F("invRadius",1.0/Range)
		shader.ProgramAttriEnd()
	End Method
	
	Method SetTextureScale(Scale:Float)
		shader.ProgramAttriBegin()
		shader.SetParameter1F("scale",1.0/Scale)
		shader.ProgramAttriEnd()
	End Method
	
	Method SetLight(Light:TLight) 
		Self.Light = Light
	End Method
		
End Type
 | 
| 
 | ||
| Thank you very much for the quick response! |