Horde3D BlitzMax wrapper (and other stuff)

A place for people with an interest in developing new shmups.
Post Reply
User avatar
worstplayer
Posts: 861
Joined: Sun Jun 17, 2007 6:48 pm
Location: Slovakia

Horde3D BlitzMax wrapper (and other stuff)

Post by worstplayer »

I use this wrapper for my game, so maybe it's a good idea to share it with the rest of you:

Beta4 (old)
SVN 245 (new)

It's originally written by seyhajin, I just modified to work with beta4. I didn't encounter any bugs, which of course doesn't mean there aren't any. I updated example scene, but not BBDOC, just use original H3D docs (included).

For those who don't know what Horde3D is:
It's a 3D engine of course. What sets it apart from the rest is that it's extremely simple and easy to use.
And when I say simple, I mean simple. Here's all you need to display a 3D scene:

Code: Select all

Import horde3d.horde3d            'import h3d wrapper
Import horde3d.horde3dutils       'import utils wrapper

H3D.OpenLibrary()      'load horde3d.dll
H3DU.OpenLibrary()     'load horde3dutils.dll

GLGraphics 800, 600                                        'open a window
H3D.Init()      'start the engine
H3D.SetupViewport( 0, 0, 800, 600, True )       'setup viewport

pipelineres = H3D.AddResource( ResTypes.Pipeline, "pipelines/forward.pipeline.xml", 0 )      'standard forward lighting pipeline
meshres = H3D.AddResource (ResTypes.SceneGraph, "models/man/man.scene.xml", 0 )   'example model
H3DU.LoadResourcesFromDisk( AppDir+"/content" )        'load all resources them from disk

cam = H3D.AddCameraNode( RootNode, "Camera", pipelineres)     'create a camera
	H3D.SetNodeTransform( cam, 5, 5, 5, -30 ,45, 0, 1, 1, 1 )    'position a camera

H3D.AddNodes( RootNode, meshres )       'create a node with your model

Light1 = H3D.AddLightNode( RootNode, "Light1", null, "LIGHTING", "SHADOWMAP" )    'create a light
	H3D.SetNodeTransform( Light1, 0, 20, 0, -90, 0, 0, 1, 1, 1 )   'position light
	H3D.SetNodeParamI(Light1, Light.ShadowMapCountI, 1)      'enable shadows

While Not (KeyHit( KEY_ESCAPE ) Or AppTerminate())	  'repeat until esc pressed or window closed
	H3D.Render( cam )     'display everything
	H3D.FinalizeFrame()    'prepare to draw next frame
	Flip -1        'swap buffers
wend

H3D.Release_()   'unload h3d
That's all. Now go and make a shmup with it.
Last edited by worstplayer on Sat Jun 12, 2010 2:40 pm, edited 2 times in total.
"A game isn't bad because you resent it. A game is bad because it's shitty."
User avatar
worstplayer
Posts: 861
Joined: Sun Jun 17, 2007 6:48 pm
Location: Slovakia

Re: Horde3D - beta4 BlitzMax wrapper

Post by worstplayer »

And here's another byproduct of Laseroid2 (yes, I started working on it again), a simple module containing various functions you may or may not find useful.
http://www.mediafire.com/?2innwydoy4y

I found myself rewriting these over and over every time I start new project, so I made a module so I don't have to do that again.

It contains following functions:

Code: Select all

NormalizedX(x,y,(z)) 'returns X component of normalized vector XY(Z)
NormalizedY(x,y,(z)) 'returns Y...
NormalizedZ(x,y,(z)) 'returns Z...

Clamp(n1,n2,n3) 'clamps value to min and max, order in which you put them doesn't matter.

PointDistance(x1,y1,x2,y2) 'distance between two points in 2D
PointDistance3(x1,y1,z1,x2,y2,z2) '...in 3D
PointDistanceSquared(x1,y1,x2,y2) 'squared distance between two points in 2D. Much faster, good for comparison (find nearest object etc...)
Function PointDistanceSquared3(x1,y1,z1,x2,y2,z2) '...in 3D
PointDirection(x1,y1,x2,y2) 'direction from X1Y1 to X2Y2 (in degrees)
Dot2(x1,y1,x2,y2) 'dot product between x1y1 and x2y2
Dot3(x1,y1,z1,x2,y2,z2) '...x1y1z1 and x2y2z2

LineToCircle(x1,y1,x2,y2,px,py,r) 'collision test between line x1y1 x2y2 and circle with center pxpy and radius r
LinesCross(x0,y0,x1,y1,x2,y2,x3,y3) 'collision test between line x0y0 x1y1 and  line x2y2 x3y3
LineToRect(x0,y0,x1,y1,rx0,ry0,rx1,ry1) 'collision test between line x0y0 x1y1 and rectangle rx0ry0 rx1ry1
If you find any bug, let me know.

EDIT: updated, fixed a tiny bug in PointDistanceSquared3, and it's now precompiled (just in case).
"A game isn't bad because you resent it. A game is bad because it's shitty."
User avatar
worstplayer
Posts: 861
Joined: Sun Jun 17, 2007 6:48 pm
Location: Slovakia

Re: Horde3D BlitzMax wrapper (and other stuff)

Post by worstplayer »

Horde3D wrapper updated to work with SVN 245 (June 03 2010)

Download

If you have any projects using beta4, please back up the old wrapper, there were some changes in shader syntax and your old stuff may not work correctly.
"A game isn't bad because you resent it. A game is bad because it's shitty."
User avatar
worstplayer
Posts: 861
Joined: Sun Jun 17, 2007 6:48 pm
Location: Slovakia

Re: Horde3D BlitzMax wrapper (and other stuff)

Post by worstplayer »

Horde3D wrapper updated to SVN 250 (June 28 2010)

Download

No major changes, most projects based on 245 should still work.
"A game isn't bad because you resent it. A game is bad because it's shitty."
Post Reply