New indiepath.modules

BlitzMax Forums/BlitzMax Programming/New indiepath.modules

TartanTangerine (was Indiepath)(Posted 2006) [#1]
Indiepath.ProjMatrix - Projection Matrix - now MacOS compat.

Indiepath.TexturedPoly - Now independent of the Official Mods and MacOS compat, contains the New DrawGlowingLines command.

Get files and examples here :- http://indiepath.com/public/indiepath_mod_update.rar

Screenie of Example:




Rimmsy(Posted 2006) [#2]
you da man. Thank you very much for these and for your constant hard work and generosity to the community.


TartanTangerine (was Indiepath)(Posted 2006) [#3]
.


BlackSp1der(Posted 2006) [#4]
Great work!.

BTW, there's no other commands for the Matrix?.
Something like:
ProjectionMatrix.Initialize(1000,700,CurrentScreenX=800,CurrentScreenY=600)
So, We can force the projection matrix to work thinking is 800,600


Haramanai(Posted 2006) [#5]
Thanks.


TartanTangerine (was Indiepath)(Posted 2006) [#6]
@BlackSpider, sorry it was late when I wrote those crappy instructions.. if you want 800 x 600 then the command is ProjectionMatrix.Initialise(800,600); It now does not matter what your real screen resolution is.

There are other commands like zoom and rotate but they don't work quite right yet.


xlsior(Posted 2006) [#7]
Thanks


BlackSp1der(Posted 2006) [#8]
Indiepath, check the next code and you will understand why I'm asking to force the matrix.
I'm using 2 times graphics to force the matrix.
Graphics 800,600,0,60
Projectionmatrix.Initialise(1000,700)
Graphics 600,600,0,60
with the key 'W' you can change the screen mode.




TartanTangerine (was Indiepath)(Posted 2006) [#9]
I really am not sure what the issue is here?

I do see one error in your code, you have to set the projection matrix after SetGraphics, which kinda makes sense.

'***********************************
	Graphics 600,600,0,60
	Projectionmatrix.Initialise(1000,700)
'***********************************


And if I remove your code that justifies the screen when FullScreen it looks the same in both modes.


TeaVirus(Posted 2006) [#10]
Indiepath, this is really cool, thanks! Works great when using DX7 but GL gives an "attampt to access field or method of null object" error when textured poly is used. Looking at the debugger, both driver fields (DX and GL) are null. Any ideas?


TartanTangerine (was Indiepath)(Posted 2006) [#11]
Strange, I don't get that error here on Win or OSX in openGL.

I've made a new version anyway which I might upload tomorrow.


InvisibleKid(Posted 2006) [#12]
thanks


BlackSp1der(Posted 2006) [#13]
.


TartanTangerine (was Indiepath)(Posted 2006) [#14]
@BlackSp1der, the command is not doing what you think it is.

The Graphics command does not set the base resolution, the ProjectionMatrix does.

Take the following example, the pixels will always be in the corner of the screen regardless of resolution.

Graphics 800,600
'Graphics 480,360
'Graphics 1024,960
ProjectionMatrix.Initialise(640,480)
Plot 0,0
Plot 640,0
Plot 640,480
Plot 0,480
Flip



-Svensken-(Posted 2006) [#15]
I get the same error as TeaVirus when going GL.
"attempt to access field or method of null object"

/svensken


GW(Posted 2006) [#16]
The ProjectionMatrix mod is cool to play with, but when in use the screen coords are still mapped to display resolution making any game that uses any kind of mouse/screen interaction a lot less usefull. its fun to play with though.


TartanTangerine (was Indiepath)(Posted 2006) [#17]
Yeah but remapping your mouse is so easy to do, it's easier than remapping every image.

	Local ActualWidth# = 480
	Local ActualHeight# = 360
	Local BaseWidth# = 800
	Local BaseHeight# = 600
	
	Local NewMouseX# = (Float(MouseX())/ActualWidth)*BaseWidth
	Local NewMouseY# = (Float(MouseY())/ActualHeight)*BaseHeight



TeaVirus(Posted 2006) [#18]
My error report above was somewhat misstated. It's actually the DXFrame and GLFrame fields that are null. I've tried again after a complete reinstall using the new 1.16 release and same problem.



TartanTangerine (was Indiepath)(Posted 2006) [#19]
Seems like you are not passing an Image or the incorrect frame.


taumel(Posted 2006) [#20]
Hi Tim,

just have seen it...nice one!

Strict

Import indiepath.texturedpoly
Import indiepath.projmatrix

AppTitle = "Subtle Glow"

'SetGraphicsDriver D3D7Max2DDriver()
SetGraphicsDriver GLMax2DDriver()

Global scrX:Float=960,scrY:Float=600,scrXm:Float=scrX*.5,scrYm:Float=scrY*.5
Graphics scrX,scrY,0

projectionmatrix.Initialise(scrX,scrY)

SeedRnd(MilliSecs())

Local Image:TImage = LoadImage("glow2.png")


Local ImageFrame:Int = 0
Local x0# = 300
Local y0# = 100
Local x1# = 400
Local y1# = 200
Local width# = 16

Local anz:Int=360,fakCol:Float=255/Float(anz)
Local i:Int=0
Local akt1:Float=0.0,del1:Float=10.0,ste1:Float=0.1,amp1:Float=100.0,spi1:Float=1.2
Local akt2:Float=30.0,del2:Float=7.0,ste2:Float=0.8,amp2:Float=180.0,spi2:Float=0.4
Local xold:Float=0.0,yold:Float=0.0

Cls
While Not KeyDown(Key_Escape)
	SetBlend LIGHTBLEND
	akt1:+ste1
	akt2:+ste2
	For i=1 Until anz
		SetAlpha(Sin(i*180.0/anz))
		SetColor(255-i*fakCol,i*fakCol,255)
		akt1:+del1
		akt2:+del2
		If akt1> 360.0 Then akt1:-360.0
		If akt1<   0.0 Then akt1:+360.0
		If akt2> 360.0 Then akt2:-360.0
		If akt2<   0.0 Then akt2:+360.0
		x1=(amp1+i*spi1)*Sin(akt1)
		y1=(amp2+i*spi2)*Cos(akt2)
		If i>1 Then
			x0=xold
			y0=yold
			DrawGlowingLine(Image,ImageFrame,x0+scrXm,y0+scrYm,x1+scrXm,y1+scrYm,width)
		End If
		xold=x1
		yold=y1
	Next
	Flip;Cls
Wend 

End

Greetings,

taumel


TartanTangerine (was Indiepath)(Posted 2006) [#21]
I got a new version coming soon.....It's been heavily optimised.


tonyg(Posted 2006) [#22]
I get the same problem as Teavirus even running Taumel's code with the max.png file.
<edit> Driver issue (?) as works with DX but not GL on my laptop. I'll check later on my PC.


TeaVirus(Posted 2006) [#23]
Indiepath,
Inspecting the indiepath.win32.*.i files it doesn't look like brl.glmax2d isn't imported in the version you've uploaded.
ModuleInfo "Version: 1.0"
ModuleInfo "Author: Tim Fisher"
ModuleInfo "License: Public Domain"
ModuleInfo "Modserver:Indiepath"
import brl.blitz
import brl.d3d7max2d
import brl.pngloader
import brl.retro
DrawTexturedPoly%(Image:TImage,frame%,xyuv#&[],RenderType%=6)="indiepath_texturedpoly_DrawTexturedPoly"
DrawGlowingLine%(Image:TImage,frame%,x0#,y0#,x1#,y1#,width#=1#)="indiepath_texturedpoly_DrawGlowingLine"



TartanTangerine (was Indiepath)(Posted 2006) [#24]
Well thats kinda odd because I've got that version running on my Mac??!?


TeaVirus(Posted 2006) [#25]
The Mac version does import brl.glmax2d. =)

texturedpoly.release.macos.i
ModuleInfo "Version: 1.0"
ModuleInfo "Author: Tim Fisher"
ModuleInfo "License: Public Domain"
ModuleInfo "Modserver:Indiepath"
import brl.blitz
import brl.glmax2d
import brl.pngloader
import brl.retro
D3DPT_TRIANGLEFAN%=9999939
D3DPT_TRIANGLESTRIP%=12536753
DrawTexturedPoly%(Image:TImage,frame%,xyuv#&[],RenderType%=9999939)="indiepath_texturedpoly_DrawTexturedPoly"
DrawGlowingLine%(Image:TImage,frame%,x0#,y0#,x1#,y1#,width#=1#)="indiepath_texturedpoly_DrawGlowingLine"



TartanTangerine (was Indiepath)(Posted 2006) [#26]
I'm going to upload the new version some time anyway.... It's got a massivly improved renderpipeline, especially in OpenGL.


TeaVirus(Posted 2006) [#27]
I look forward to trying it. Thanks!!


Qweeg(Posted 2006) [#28]
Just came across the projection matrix - fantastic stuff Indie! I was wondering though, how to handle widescreen monitors? I currently set the projection matrix to 1024*768 and then whatever monitor I run on everything scales nicely up to full screen. But for a widescreen monitor I don't want this because the images all get stretched. It's not so bad on a flatscreen with a ratio of 5:4 instead of 4:3 but most laptops seem to be widescreen these days.


TartanTangerine (was Indiepath)(Posted 2006) [#29]
I'd suggest setting the projection matrix to the resolution of the monitor you are running on. Perhaps have a switch in game that allows the user to select widescreen mode.


Qweeg(Posted 2006) [#30]
Thanks Indie. In the end what I have done is utilise your projection matrix in conjunction with the GUI module, since my game uses a gui canvas for graphics (as I need to use gadgets).

So what I have done is create a base full screen window (sized to whatever the monitor is set at). Then the game window sits on this it's size is adjusted according to the aspect ratio of the monitor - so that the window always appears in 4:3 ratio. Then I can just colour/texture the base full screen window, so that bars (down the sides for widescreen or top and bottom for 5:4) don't look out of place.

Using the projection matrix makes this all work really nicely - monitors that are in a 4:3 aspect ratio run in complete full screen, and 5:4 and widescreen are scaled up as much as possible whilst still maintaining 4:3 ratio, and the unused sections of the screen are masked with an appropriate texture.

Probably not how other people do this, but I am happy with the results, if anyone does want to see then here is some example code:

thanks again Indie.

Global varScreenWidth : Float = 1024
Global varScreenheight : Float = 768
Global varXScaleFactor : Float = Desktop().width / varScreenWidth
Global varYScaleFactor : Float = Desktop().Height / varScreenheight


Type typInterface
	
	Field gdtParentWindow:TGadget	
	Field gdtWindow:TGadget
	Field gdtCanvas:TGadget
	Field gdtTextBox:TGadget
	Field gdtChatBox:TGadget
	Field blnChatInitialised:Int = False
	Field fntChatBoxFont:TGuiFont=LoadGuiFont( "Verdana",10,True)
	Field intSelectedChatLine:Int = 0

	Method InitialiseGameWindow()     
		         
		Local varWidth:Float = Desktop().width
		Local varHeight:Float = Desktop().Height
		Local varRatio:Float = varHeight / varWidth
		
		'Fix the aspect ratio to 4:3 by creating a full screen parent window then sitting a window sized to the maximum allowed
		'whilst still keeping a 4:3 ratio.  Then use Indiepaths fab Projection Matrix to ensure graphic and positions are scaled correctly
		Self.gdtParentWindow = CreateWindow("", 0, 0, ClientWidth(Desktop()), ClientHeight(Desktop()), Null, 0)
		If varRatio < 0.7 'widescreen
			Self.gdtWindow = CreateWindow("", (varWidth - (varHeight * 1.25)) / 2, 0, varHeight * 1.25,varHeight, Self.gdtParentWindow, 0)
			varXScaleFactor = (varHeight * 1.25) / varScreenWidth
			varYScaleFactor = varHeight / varScreenHeight
		Else '4:3 or 5:4
		'    Self.gdtWindow = CreateWindow("", 0, 0, ClientWidth(Desktop()), ClientHeight(Desktop()), Null, 0)
			Self.gdtWindow = CreateWindow("", 0,(varHeight - (varWidth * 0.75)) / 2, varWidth,varWidth * 0.75, Self.gdtParentWindow, 0)
			varXScaleFactor = varWidth / varScreenWidth
			varYScaleFactor = (varWidth * 0.75) / varScreenHeight
		EndIf
		Self.gdtCanvas = CreateCanvas(0, 0, ClientWidth(Self.gdtWindow), ClientHeight(Self.gdtWindow), Self.gdtWindow) 
		
		SetGadgetLayout(Self.gdtCanvas, 1, 1, 1, 1)                          		                                                                       
		SetGraphics CanvasGraphics(Self.gdtCanvas)
		ActivateGadget(Self.gdtCanvas)
		EnablePolledInput()
		projectionmatrix.Initialise(1024,768) 'This ensures that the game graphics display in full window regardless of the monitor setting
		  
	EndMethod



Qweeg(Posted 2006) [#31]
Is it possible for these modules to go onto the axe.mod server with the other useful module built by users? It seems like a lot of people find Indie's mods really useful and it sounds like if Skid is contacted directly he may maintain these (it must be a complete pain for Indie having to look at these again after each release):

http://www.blitzbasic.com/Community/posts.php?topic=57472&hl=axe


TartanTangerine (was Indiepath)(Posted 2006) [#32]
if/when I sell them I will maintain them, that is the only reason for me charging any money.


Fetze(Posted 2006) [#33]
Hi Indiepath. I've just tried out your DarTexturedPoly-Module, but it seems, there are a few bugs in it.

First:
It only works with D3D. If I try to draw a textured Poly in OpenGL, it crashes with the error, TeaVirus mentioned some posts ago.

Second:
There has to be a Bug with the Vertex-Coordinates. I draw a non-textured-BMax-Poly (a simple Quad). Then, I draw a textured Poly at the same position (Texture has no transparent/masked space), but it does not overlap perfectly, as it should. At the right side and at the lower side there are some pixel-lines missing. The Image's scale seems to be incorrect.

Here are my coordinate-arrays:
Poly:
100.0, 100.0,
190.0, 100.0,
190.0, 190.0,
100.0, 190.0

Textured Poly
100.0, 100.0, 0.0, 0.0,
190.0, 100.0, 1.0, 0.0,
190.0, 190.0, 1.0, 1.0,
100.0, 190.0, 0.0, 1.0

It would be nice, if you fixed those bugs, i could really use a DrawTexturedPoly-Function right now.. :/

Edit:
I've got a feature request too: Could you, optional, in a second array support Vertexalpha and Vertexcolor? That would be REALLY cool =)


Fetze(Posted 2006) [#34]
Indiepath? Answer? ^^


TartanTangerine (was Indiepath)(Posted 2006) [#35]
The new, unlreleased version is fixed and has the additional features you wanted including lit vertexes, specular and Dot3. As with most things, when I have the time I will release it.


Dreamora(Posted 2006) [#36]
*waiting for 1.18 versions of your modules :-)*

Good work


Fetze(Posted 2006) [#37]
I assume, that Specular and Dot3 have something to do with Bumpmapping? ^^


tonyg(Posted 2006) [#38]
Tim, what happened with the plan to sell these modules?
It would make me feel less guilty about hassling you for error fixes and updates.


Space_guy(Posted 2006) [#39]
That sounds great Indiepath.
Good luck with finding that time ;)


TartanTangerine (was Indiepath)(Posted 2006) [#40]
I apologise if people are getting mixed messages from me about what I'm going to do any when. The bottom line is that I'm absolutely maxed out at the moment, and whilst these modules are low priority for me I do understand that they may be high priority for you.

Perhaps there is someone on this forum who would like to handle the sale of the modules, and front-line support, for a healthy chunk of the revenue?


SillyPutty(Posted 2006) [#41]
oh yeah please, someone needs to do that, there is more than enough talent on these boards to head that up.


TartanTangerine (was Indiepath)(Posted 2006) [#42]
Whoa, that must have scared everyone away.


Space_guy(Posted 2006) [#43]
Apparently. i am ready to buy even though my wallet is quite thin. but i dont have the time and experience to help you sell and support it.
I sorta wished someone would have raised her voice though.
Well good luck anyway. i will look forward to the day i can get my hands on them. till then i will have to do with what i have


Fetze(Posted 2006) [#44]
I think, I'd buy too, but it really really hope, that it will be a fair prize.


H&K(Posted 2006) [#45]
Is this still about?


Dreamora(Posted 2006) [#46]
The modules have been release to the public ... at least render2texture and the polygone part when I remember right (only use r2t)


H&K(Posted 2006) [#47]
Its the polygon part I was interested in, but I cannot find a working link. Anyideas where it is?


TartanTangerine (was Indiepath)(Posted 2006) [#48]
We removed all the modules from the public domain due to the ridiculous number of support emails we were getting. We really thought people would use the modules to learn from - but alas everyone wants us to debug their games - not a chance.


Yan(Posted 2006) [#49]
We really thought people would use the modules to learn from
Did you release the source code, at some stage then? I must've missed that.


H&K(Posted 2006) [#50]
Ok.

Can you posibly post the code to TexturedPoly?

If not, could you advice me as to the best way to aprocah this problem. Because all the "Good" searches contain soly this as the solution. (Thats not true, but close enough ;)

Ive been trying to do it, For "Petty" changes to a simple quad, by a combination of pixgrab/resize and Setrotate/scale this means, (Because of how slow it is) that most times Ive had to "pre-create" a set of images.

The other solution Ive been looking at was simply follow the Nehe Tutorial 6, and use gl, but... (It would be the first time Id used any of the Gl stuff, and I get lost really quickly)

Was your method OpenGl dependent? If not how was it done.

Thanks


Dreamora(Posted 2006) [#51]
The easiest way is to take the BM sources as start. Both, DX and OpenGL drivers already feature polys but implicitely want that no texture is bound ... so all you theoretically need to do is bind a texture ie copy the code and allow it to work with a set texture. I've that in my source and works without probs (I manually feed it with vertex - uv arrays)


H&K(Posted 2006) [#52]
Well, dont suppose you would like to explain that in a tutorial would you?


TartanTangerine (was Indiepath)(Posted 2006) [#53]
Did you release the source code, at some stage then? I must've missed that.
Yes I did release the source code to all the modules.


Dreamora(Posted 2006) [#54]
No H&K, sorry.

But as mentioned, check the BM sources, they will give you a quite good starting as they have everything in you need to get a basic understanding.

The rest is just creating of functions to use it in a less cryptic way :-) And those functions heavily depend on your needs. Some use it to create isometric tiles from their textures, other use it for funky effects etc.


tonyg(Posted 2006) [#55]
includes Tim's DX TexturePoly plus GL TexturedPoly.


popcade(Posted 2006) [#56]
Indiepath's modules are nice, it's a pity i missed it :|


TartanTangerine (was Indiepath)(Posted 2006) [#57]
I've been approached by an individual who is interested in maintaining the modules on the behalf of Indiepath. I am looking forward to their proposition.


popcade(Posted 2006) [#58]
So it will possibly got maintained when there's a new BMax version that break module compatibility?


daaan(Posted 2006) [#59]
Soo... some people got it for free... and now some people have to pay? huh? How much? When?


popcade(Posted 2006) [#60]
Actually modules are free, and "TexturedPoly", "Render2Texture", "ProjectionMatrix" are publically open sourced, very great piece of mods.

I just afraid Mark will break the modules again.... in the next update.


TartanTangerine (was Indiepath)(Posted 2006) [#61]
Looks like the 3rd party is not going to be involved after all. The modules look like they will stay in-house.


Abomination(Posted 2006) [#62]
@Indiepath:
Could You please explain how these mods are alowed to be used?
Does one need a licence to use them for games?
I was thinking of including Render2Texture in my GUI, but that is probably a big no-no?


H&K(Posted 2006) [#63]
@yoxola,
Actually modules are free, and "TexturedPoly", "Render2Texture", "ProjectionMatrix" are publically open sourced, very great piece of mods.

Brilliant, Linky?

Then again maybe you missed this
We removed all the modules from the public domain

and this
My Other modules rely on this core module so I decided to release it Free of charge. This is not Open Source even though source is included.

(But equaly I might just be stupid in my searches for it)
Edit: http://www.blitzbasic.com/Community/posts.php?topic=51059#569148


IndiePath, if I promise not to ask any questions about it at all, could you let me have TexturedPoly?


popcade(Posted 2006) [#64]
http://www.pyroplay.de/softshadows.html
Follow tonyg's site and you can get 2 of them, but ProjectinMatrix was removed with indie's closure of hismodule board.

Without his permission I can't distribute it tho...

I really want to start a project like PBOSL that collect open-sourced libraries in a convenient pack, I may call it BMOSL.... I have space now, just need time to make a site of it.


H&K(Posted 2006) [#65]
lol, bacause it was in rar, ive had it sitting unopened on my hd. Thanks everone.


TartanTangerine (was Indiepath)(Posted 2006) [#66]
If you have concerns about the license then please email me.

With regard to restrictions, there are none other than I would urge you to credit Indiepath for providing the code - that is all.


Filax(Posted 2007) [#67]
It's me or there is a problem with bmax 1.24 on the :

primarydevice.device

??


Grey Alien(Posted 2007) [#68]
most likely. Read this: http://www.blitzbasic.com/Community/posts.php?topic=65846


Filax(Posted 2007) [#69]
Hum :) Many thanks Grey Alien, but i have try to convert
indiepath textured poly module but without result...

There too many changes :/

If anybody convert indiepath glow vector module for 1.24
let's roll :)

With the new driver changes, what the new commands for this
line ?

If TD3D7Max2DDriver(_max2dDriver).IsLost=False

Any idea ??


Filax(Posted 2007) [#70]
I have find :

TD3D7GraphicsDriver.IsValid


Space_guy(Posted 2007) [#71]
Textured poly was no big problem to update for me.
Im stuck at rendertotexture though


TartanTangerine (was Indiepath)(Posted 2007) [#72]
Perhaps someone could email me the updates they have already made - no point doubling up on work:)


Filax(Posted 2007) [#73]
My last version seem to work, but i'm not really sure of the
modifications ? Can you give me an email adress indie ? :)

primary.device was replaced by : D3D7GraphicsDriver().Direct3DDevice7()

I hope that good ? But seem compile without error


TartanTangerine (was Indiepath)(Posted 2007) [#74]
just whack something over to indiepath.com


popcade(Posted 2007) [#75]
Is there the Lights2D module available again? That one is useful and I hope to see it working on 1.24 (and later versions).

I'd want to pay/donate for the Lights2D source, for learning purpose(didn't have attempt to make game for a long while, but still playing BMax...)


Wiebo(Posted 2007) [#76]
Anyone gotten this to work? I need to re-compile the mods to get my games working again :|


Wiebo(Posted 2007) [#77]
nm, it's working now :)