Indiepath modules

Miscellaneous Forums/General Discussion/Indiepath modules

Are these still available anywhere?

Found 'em!

http://66.102.9.104/search?q=cache:4CnAuKJPkqUJ:modules.indiepath.com/+indiepath+modules&hl=en&ct=clnk&cd=1&gl=uk

I didnt think they worked under 1.24?

wouldn't this link be easier http://modules.indiepath.com/forum/index.php

The only one I want is the projection matrix mangler... and with regards to this one at least, you appear to be correct. Any ideas how to detect if blitz is running in DX mode on the latest version??

Any ideas how to detect if blitz is running in DX mode on the latest version
errr. When You set it to DX set a Global UsingDX=True (Theres probably some simple system way as well)

I just use graphics and let the system set whatever. I'm trying to update Indiepath's module, so I want a general way to detect the driver, independent of any flags I set outside.

wouldn't this link be easier
Indeed!

Deleted because it was wrong

if _max2dDriver.Tostring()= "DirectX7" then You are in DX7 Mode
The implimentation of ToString in each of the drivers has what the string is
DirectX7
OpenGL
I assume that the DX9 driver floating about sets it to DirectX9

I will convert these at some point but I'm too busy right now - sorry.

There are plenty of working routines floating about.

Search the forums.

Should help with another example by Yan included.
Tim, I think I have a working copy of your projmatrix.bmx. Do you mind if I post it here for people to test?

@tonyg - go ahead, please.

Strict

Rem
bbdoc: Projection Matrix - How To Set Matrix For scales
End Rem
Module Indiepath.projmatrix

ModuleInfo "Version: 1.0"
ModuleInfo "Author: Tim Fisher"
ModuleInfo "License: Indiepath License for non warranted software"
ModuleInfo "Modserver:Indiepath"
'End Rem
?Win32
Import BRL.D3D7Max2D
?
Import BRL.GLMax2D

Type ProjectionMatrix
	Field Scale:Float
	Field width:Float
	Field height:Float
	Field depth:Float
	Field angle:Float
Rem
bbdoc:Initialise and create a new Projection Matrix Object
returns: Returns handle to object
about: Pass base resolution width, height and depth. Angle and scale are not currently implemented
End Rem	
	Function Initialise:ProjectionMatrix(width:Float=800,height:Float=600,depth:Float=2,angle:Float=0,scale:Float=1)
		Local p:ProjectionMatrix = New ProjectionMatrix
		p.width = width
		p.height = height
		p.scale = scale
		p.depth = depth
		p.angle = angle
		p.Set()
		Return p
	End Function
Rem
bbdoc: Free the matrix object
End Rem	
	Function Free(p:ProjectionMatrix)
		p = Null
	End Function
	

	Method Set()
?Win32
		If D3D7GraphicsDriver().Direct3DDevice7() = Null Then
			glMatrixMode GL_PROJECTION
			glLoadIdentity
			glOrtho 0,Self.width,Self.height,0,-1,1
			glMatrixMode GL_MODELVIEW
		Else
			Local matrix#[]
			
			Local sx:Float = (2.0/Self.Width) '* Cos(Self.Angle)
			Local sy:Float = (2.0/Self.Height) * Cos(Self.Angle)
			Local sx1:Float = -Sin(Self.Angle)
			Local sy1:Float = Sin(Self.Angle)
			
			matrix=[..
			sx		,0.0		,0.0			,0.0,..
			0.0		,-sy		,0.0			,0.0,..
			0.0		,0.0		,2.0/Self.depth	,0.0,..
			-1-(1.0/Self.width),1+(1.0/Self.height),1.0,1.0]
			D3D7GraphicsDriver().Direct3DDevice7().SetTransform(D3DTS_PROJECTION,matrix)
			
		EndIf
?MacOS
		glMatrixMode GL_PROJECTION
		glLoadIdentity
		glOrtho 0,Self.width,Self.height,0,-1,1
		glMatrixMode GL_MODELVIEW

?
	End Method
	
	Method Rotate(angle:Float)
		Self.Angle = angle
		Self.Set()
	End Method
Rem
bbdoc: Translate Mouse
returns: Translated x & y
about: Translates the mouse position depending on matrix settings.
End Rem		
	Method TranslateMouse(x# Var, y# Var)
		x# = (MouseX()/Float(GraphicsWidth()))*Self.Width
		y# = (MouseY()/Float(GraphicsHeight()))*Self.Height
	End Method
End Type


Wow this has been a productive thread in my absence! Thanks all for the help.

So uh, remind me again what's this for? Can I scale the entire screen up or down (e.g. zoom in)? It would be neat to zoom in the whole screen without having to apply the correct scale to every object I draw (some are already drawn half size etc so would need to be multiplied by the screen scale.).

So uh, remind me again what's this for? Can I scale the entire screen up or down (e.g. zoom in)? It would be neat to zoom in the whole screen without having to apply the correct scale to every object I draw (some are already drawn half size etc so would need to be multiplied by the screen scale.).

It's so you don't need to scale (and move) everything when zooming or changing resolutions. Simply set the matrix and your object positions and scales will be the same on any resolution/ratio.

So can it be used for a realtime scale. i.e. change the values each frame?

aye

If _max2dDriver.Tostring()= "DirectX7"
or
If D3D7GraphicsDriver().Direct3DDevice7() = Null


@Anyone who knows
Ok so we have two ways of detecting DX or not, which one would you say is most sutibly "Correct" one.
The first one, (which took me ages, loading in the Mods, and using Blide, to figure out), or Indies/Tonygs one, which seems more elegant.

I (obviously), preffer my one, because any extention of max2dDriver should have a ToString, and I wouldnt have to know what the extended type was called.

Go you route, it's more robust when it comes to future expansion.

Didn't Mark suggest checking D3D7GraphicsDriver.IsValid?

Hummm, Maybe, but whats the point of actualy having a ToString(), if its not an accepted way of doing it.

I admit that it didnt accur to me at first, But surly every type extened from "Object", (ie All of them), Have a ToString.

And in this (and lots of other) situations, it make sence to actualy use this Method.

PS, And even if you think it doesnt, I am from now on going to override it when ever it can be used like this, its going to make some of those "Exactly what extened version of this base object is it" questions simpler