That was fast, thanks chi!
704 looks great, nice physics overhaul. Can't wait to test it.
Xors3d for Purebasic
Re: Xors3d for Purebasic
... updated to rev. 710 (http://area.xors3d.com/forums/viewtopic.php?f=22&t=551)
Et cetera is my worst enemy
Re: Xors3d for Purebasic
i have tried xord3d for purebasic http://area.xors3d.com/forums/viewtopic.php?f=22&t=551
we need to edit file Xors3d_FastImage.pbi in compilers folder to work with PB 5.11 else you will get
Boolean comparisons can only be used with test operators like If, While, Repeat. Use Bool() instead.
change Line 342: textureFlags = (textureFlags And $3F) Or $9
to
textureFlags = Bool(Bool(textureFlags And $3F) Or $9)
Line 437:
*FI_FontProperty\Image = xLoadImageEx(Left(filename,f-1)+AnimTexture, Bool(Bool(AnimTextureFlags And $6) Or $39), flags)
i have used it to display mandelbrot 3d, it is 5 times speedier than PB ogre or mp3d in this specific subject, may be it is using single precision internally like Blitz3D do.
2000000 iteration, results in 90000 colored points to form the 3D cloud
in 2 seconds only, while in Ogre code it is 10 seconds http://www.purebasic.fr/english/viewtop ... 36&t=53558 ,there is a small nag that i must use one trivial line tri1 = xAddTriangle(surf, v(0), v(0), v(0)) to show the points, and xEntityFX(mesh, 2|1) to show the points in color !!!??? .
other example display a cube with blue sphere inside
Example 3D Line :
other example display from the Blitz3D xors3d examples :a torus falling over a thin cyclinder, the torus are given a property :
concave = xCreateTorus(16, 1, 0.5)
xEntityAddConcaveShape(concave, 100.0)
the xEntityAddConcaveShape functions enable the torus to have a dynamically concave physics so the cyclinder can go through its hole.
my opinion it is a good engine but its price $100 which are may be suitable for games makers but too much for the hobbyist , while a $50 are more suitable.
we need to edit file Xors3d_FastImage.pbi in compilers folder to work with PB 5.11 else you will get
Boolean comparisons can only be used with test operators like If, While, Repeat. Use Bool() instead.
change Line 342: textureFlags = (textureFlags And $3F) Or $9
to
textureFlags = Bool(Bool(textureFlags And $3F) Or $9)
Line 437:
*FI_FontProperty\Image = xLoadImageEx(Left(filename,f-1)+AnimTexture, Bool(Bool(AnimTextureFlags And $6) Or $39), flags)
i have used it to display mandelbrot 3d, it is 5 times speedier than PB ogre or mp3d in this specific subject, may be it is using single precision internally like Blitz3D do.
2000000 iteration, results in 90000 colored points to form the 3D cloud
in 2 seconds only, while in Ogre code it is 10 seconds http://www.purebasic.fr/english/viewtop ... 36&t=53558 ,there is a small nag that i must use one trivial line tri1 = xAddTriangle(surf, v(0), v(0), v(0)) to show the points, and xEntityFX(mesh, 2|1) to show the points in color !!!??? .
Code: Select all
Declare.f calcleng( x.f, y.f, z.f)
Procedure.f RandF(Min.f, Max.f, Resolution.i = 10000)
ProcedureReturn (Min + (Max - Min) * Random(Resolution) / Resolution)
EndProcedure
Global.f dx, dy, x, y, z
Global wd, ht, i, count, n, iter
Global.f w, leng, tx, ty, tz, tem
Global.f cr, ci, cj, ck, wk, inc, distance
Global mand, zval
Global.f angle
Dim v(100000) ; to hold vertices indexes
Define.f red, green, blue
wd = 500
ht = 500
;defines the shape of the Julia Set
cr = -0.200
ci = 0.800
cj = 0.000
ck = 0.000
wk = 0.000
;mand = 0 is Julia Set
;mand = 1 is Mandelbrot 3D
mand = 1
;zval = 1 shows entire set
;zval = 0 cuts set in half
;zval = 0 is an interesting effect
zval = 1
iter = 5
inc = 5
;#quat = 1
zval = 1
iter = 5
inc = 5
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d.pbi"
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d_FastImage.pbi"
xGraphics3D( 640, 480, 32, #False, #True)
; initialize fastimage font + image
xInitDraw()
xSetImageFont(xLoadImageFont(".\media\Tahoma.txt"));xSetTextureFiltering(TF_ANISOTROPIC)
light = xCreateLight(1)
;xAntiAlias(True)
mesh = xCreateMesh ()
xMeshPrimitiveType (mesh, 1)
surf = xCreateSurface(mesh, brush)
xSurfacePrimitiveType (surf, 1)
;wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
zz.f
foo.l
;iterations = 2266000
iterations = 2000000
count = 0
If zval = 0
zz = 2.0
Else
zz = 4.0
EndIf
For foo = 0 To iterations
;x.f = RandF(0, 1)
;y.f = RandF(0, 1)
x.f = RandF(-2, 2)
y.f = RandF(-2, 2)
z.f = zz*RandF(0, 1) -2.0
;calls the quaternion calculation
leng.f = calcleng(x,y,z)
If leng < 4
red = (x+Cos(15*leng))*255
green = (y+Sin(1-leng)*Cos(5*leng))*255
blue = (z+Sin(0.75*leng))*255
If red < 0 : red = 0 : EndIf
If green < 0 : green = 0 : EndIf
If blue < 0 : blue = 0 : EndIf
If red > 255 : red = red-255 : EndIf
If green > 255 : green = green-255 : EndIf
If blue > 255 : blue = blue-255 : EndIf
i+1
;xAddVertex (Surface *surface, float x, float y, float z, float u=0.0f, float v=0.0f, float w=0.0f)
v(i)= xAddVertex(surf, x, y, z)
xVertexColor(surf, v(i), red, green, blue, 1)
EndIf
Next
;the following line is to make xEntityFX(mesh, 2|1) to not giving an error
tri1 = xAddTriangle(surf, v(0), v(0), v(0))
;wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
;creating the camera
cam = xCreateCamera()
xMoveEntity(cam, 0, 0, -7)
xEntityFX(mesh, 2|1)
xFlipMesh(mesh)
xUpdateNormals(mesh)
While(Not (xKeyHit(#KEY_ESCAPE) Or xWinMessage("WM_CLOSE")))
xTurnEntity(mesh, 0, 1, 0)
xUpdateWorld()
xRenderWorld()
xText(10, 10, "Mandelbrot set 3D!")
xText(10, 30, "FPS: " + xGetFPS())
xFlip()
Wend
End
Procedure.f calcleng( x.f, y.f, z.f)
w.f: kr.f: ki.f: kj.f: kk.f
w = wk
n = 0
If mand = 1 ;full Mandelbrot set
kr = x
ki = y
kj = z
kk = 0
Else ;else draw Julia Set
kr = cr
ki = ci
kj = cj
kk = ck
EndIf
While n < iter
tem = x+x
x = x*x-y*y-z*z-w*w+kr
y = tem*y + ki
z = tem*z + kj
w = tem*w + kk
n+1
distance = x*x+y*y+z*z+w*w
If distance > 4
n = iter
EndIf
Wend
;Return distance
ProcedureReturn distance
EndProcedure
Code: Select all
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d.pbi"
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d_FastImage.pbi"
xGraphics3D( 640, 480, 32, #False, #True)
; initialize fastimage font + image
xInitDraw()
xSetImageFont(xLoadImageFont(".\media\Tahoma.txt"));xSetTextureFiltering(TF_ANISOTROPIC)
light = xCreateLight(1)
;xLightColor(light, 255,255,255)
;xAntiAlias(True)
Dim v(1000000)
mesh = xCreateMesh ()
xMeshPrimitiveType (mesh, 1)
surf = xCreateSurface(mesh, brush)
xSurfacePrimitiveType (surf, 1)
For i=0 To 100000
;MP_SetPrimitives(Entity, i, Random(200,0), Random(200,0), Random(200,0), $FFFFFFFF)
x = Random(200)-100:y = Random(200)-100:z = Random(200)-100
If y< -80 And z< -80
r=255:g=0:b=0
ElseIf x < -80 And z< -80
r=0:g=255:b=0
ElseIf x< -80 And y< -80
r=0:g=0:b=255
Else
r=255:g=119:b=119
EndIf
;(x - x0)^2 + (y - y0)^2 + (z - z0)^2 <= r^2
;check if point inside a specific sphere:
If (Pow(x,2) + Pow(y,2) + Pow(z,2)) <= 4900
r=0:g=0:b=255
EndIf
v(i) = xAddVertex(surf, x, y, z, 0, 1)
xVertexColor(surf, v(i), r, g, b, 1)
Next
tri1 = xAddTriangle(surf, v0, v0, v0)
xUpdateNormals(mesh)
;creating the camera
cam = xCreateCamera()
xPositionEntity(mesh, 0,50,0)
xPositionEntity(cam, 0, 180, -500)
xRotateEntity(cam, 15,0,0)
xVertexCoords(surf, v2, 3, 5, 0)
;t1 = xLoadTexture("green.png")
;xEntityTexture(mesh, t1)
xEntityFX(mesh, 2|1)
;xFlipMesh(mesh)
xUpdateNormals(mesh)
While(Not (xKeyHit(#KEY_ESCAPE) Or xWinMessage("WM_CLOSE")))
xTurnEntity(mesh, 0,0.5, 0)
xUpdateWorld()
xRenderWorld()
xText(10, 10, "Hello 3D World!")
xText(10, 30, "FPS: " + xGetFPS())
xFlip()
Wend
End
Code: Select all
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d.pbi"
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d_FastImage.pbi"
xGraphics3D( 640, 480, 32, #False, #True)
; initialize fastimage font + image
xInitDraw()
xSetImageFont(xLoadImageFont(".\media\Tahoma.txt"))
;xHidePointer()
camera = xCreateCamera()
light = xCreateLight()
cube = xCreateCube()
line0 = xCreateLine3D (0, 0, 0, 1, 1, 2, 0, 255, 0, 255)
xPositionEntity(line0, -2.0, 0.0, 5.0)
xPositionEntity(cube, 0.0, 0.0, 10.0)
;While Not xKeyHit(1) Or xWinMessage("WM_CLOSE")
While(Not (xKeyHit(#KEY_ESCAPE) Or xWinMessage("WM_CLOSE")))
xTurnEntity(line0, 0.3, 0.3, 0.3)
xTurnEntity(cube, 0.1, 0.1, 0.1)
xRenderWorld()
xText(10, 10, "3D Line")
xText(10, 30, "FPS: " + xGetFPS())
xFlip()
Wend
End
concave = xCreateTorus(16, 1, 0.5)
xEntityAddConcaveShape(concave, 100.0)
the xEntityAddConcaveShape functions enable the torus to have a dynamically concave physics so the cyclinder can go through its hole.
Code: Select all
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d.pbi"
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d_FastImage.pbi"
Declare.f CurveValue( newvalue.f, oldvalue.f, increments )
Declare CreateCheckerTexture()
Declare Reset()
; initialize graphics mode
xGraphics3D( 640, 480, 32, #False, #True)
; initialize fastimage font + image
xInitDraw()
xSetImageFont(xLoadImageFont(".\media\Tahoma.txt"))
;wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
;wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
#maxCameraAngle = 85.0
#minCameraDistance = 50
#maxCameraDistance = 110
xCreateLog(LOG_HTML, LOG_INFO, "Concave body.html")
xHidePointer()
cameraDistance = 60
Global camPiv = xCreatePivot()
Global camera= xcreatecamera(camPiv)
xPositionEntity(camera,0,20, -cameraDistance)
xCameraClsColor(camera, 96, 128, 192)
xRotateEntity(camPiv, maxCameraAngle / 2, 45, 0)
xCameraEnableShadows(camera)
lightRed = xcreatelight()
xRotateEntity(lightRed, 60, 15, 0)
xLightColor(lightRed, 255, 255, 255)
lightBlue = xcreatelight()
xRotateEntity(lightBlue, 60, 195, 0)
xLightColor(lightBlue, 128, 128, 255)
xLightEnableShadows(lightBlue, True)
xLightShadowEpsilons(lightBlue, 0.0001, 0.0001)
xSetShadowParams(2, 0.75)
xInitShadows(1024, 0, 0)
tex = CreateCheckerTexture()
xScaleTexture(tex, 0.1, 0.1)
Global ground = xCreateCube()
xScaleEntity(ground, 100, 1, 100)
xEntityColor(ground, 64, 64, 64)
xEntityTexture(ground, tex)
xEntityFX(ground, #FX_FULLBRIGHT)
xEntityAddBoxShape(ground, 0)
Global concave = xCreateTorus(16, 1, 0.5)
;xScaleEntity(concave, 4.0, 4.0, 4.0)
xScaleMesh(concave, 4.0, 4.0, 4.0) ; don't use xScaleEntity with a concave body. It's a temporary issue
xEntityAddConcaveShape(concave, 100.0)
xEntityColor(concave, 255, 128, 32)
xEntityTexture(concave, tex)
Reset()
Global column = xCreateCylinder()
xScaleEntity(column, 1.0, 5.0, 1.0)
xEntityColor(column, 32, 128, 255)
xPositionEntity(column, 0.0, 5.0, 0.0)
xEntityAddCylinderShape(column, 0.0)
xEntityTexture(column, tex)
xPhysicsDebugRender(PXDD_WIREFRAME)
While Not xKeyDown(#KEY_ESCAPE)
; camera control
If xKeyDown(#KEY_W) : xMoveEntity( camera, 0, 0, 0.5 ) : EndIf
If xKeyDown(#KEY_S) : xMoveEntity( camera, 0, 0, -0.5 ) : EndIf
If xKeyDown(#KEY_A) : xMoveEntity( camera, -0.5, 0, 0 ) : EndIf
If xKeyDown(#KEY_D) : xMoveEntity( camera, 0.5, 0, 0 ) : EndIf
mxs.f = CurveValue(xMouseXSpeed() * mousespeed, mxs, camerasmoothness)
mys.f = CurveValue(xMouseYSpeed() * mousespeed, mys, camerasmoothness)
camxa.f = Mod( camxa - mxs, 360 )
camya.f = camya + mys
If camya < -89 : camya = -89 : EndIf
If camya > 89 : camya = 89 : EndIf
xMoveMouse( xGraphicsWidth() / 2, xGraphicsHeight() / 2 )
xRotateEntity( camera, camya, camxa, 0.0 )
If xKeyHit(#KEY_SPACE)
Reset()
EndIf
If xKeyHit(#KEY_x)
xRotateEntity(ground, 20, 0, 0.0)
EndIf
;UpdateCamera()
rot=rot+100
xRotateEntity(concave, -90.0, rot, 0.0)
xUpdateWorld()
xRenderWorld(1, True)
xText(10, 10, "FPS: " + xGetFPS())
xText(10, 30, "Press <Space> to reset scene")
xflip()
Wend
End
Procedure Reset()
xEntityReleaseForces(concave)
xPositionEntity(concave, 0.0, 20.0, 0.0)
xRotateEntity(concave, -35.0, 0.0, 0.0)
xEntityWakeUp(concave)
EndProcedure
Procedure CreateCheckerTexture()
size = 256
lTex.f = xCreateTexture(size, size)
xSetBuffer(xTextureBuffer(lTex))
xColor(222, 222, 222)
xRect(0, 0, size, size, 1)
xColor(255, 255, 255)
xRect(0, 0, size / 2, size / 2, 1)
xRect(size / 2, size / 2, size / 2, size / 2, 1)
xSetBuffer(xBackBuffer())
ProcedureReturn lTex
EndProcedure
Procedure.f CurveValue( newvalue.f, oldvalue.f, increments )
If increments > 1 : oldvalue = oldvalue - (oldvalue - newvalue) / increments : EndIf
If increments <= 1 : oldvalue = newvalue : EndIf
ProcedureReturn oldvalue
EndProcedure
Re: Xors3d for Purebasic
At the moment I do NOT recommend purchasing a license for Xors3d as there hasn't been updates for well over a year and the engine developers have all gone missing. It's a great engine and works as expected, but its future is really uncertain. Don't purchase.applePi wrote:my opinion it is a good engine but its price $100 which are may be suitable for games makers but too much for the hobbyist , while a $50 are more suitable.
Re: Xors3d for Purebasic
Squid posted a sign of life (http://area.xors3d.com/forums/viewtopic.php?f=5&t=1004) two days ago! So maybe...eesau wrote:... and the engine developers have all gone missing.
Et cetera is my worst enemy
Re: Xors3d for Purebasic
Okay, didn't know that. Good news I guess, glad to hear he wasn't dead.chi wrote:Squid posted a sign of life (http://area.xors3d.com/forums/viewtopic.php?f=5&t=1004) two days ago! So maybe...
Re: Xors3d for Purebasic
before about a week i was about to post here a title " Xors3D Dead ??" , this is because the xors3d forum and all subforums was closed for more than 10 days with a message "Site Temporarily Unavailable" look this huge xors3d russian forum in the middle of the page with the title " Game over " http://forum.boolean.name/showthread.php?t=6180&page=43 , but suddenly the forum come alive again, and its developer are resurrected again. good to know that.
Re: Xors3d for Purebasic
... updated to rev. 750 (no trial + splash screen)
Is anyone interested in the AlbaLynx GUI? http://web.archive.org/web/201412161930 ... alynx.com/
I just found the source code and was able to build 0.11.2.0 (without splash screen ^^)
Should be pretty easy to port to any 2d/3d engine, too (hint, hint)... But for now I'm only thinking about the Xors3d port (if at all)
Is anyone interested in the AlbaLynx GUI? http://web.archive.org/web/201412161930 ... alynx.com/
I just found the source code and was able to build 0.11.2.0 (without splash screen ^^)
Should be pretty easy to port to any 2d/3d engine, too (hint, hint)... But for now I'm only thinking about the Xors3d port (if at all)
Et cetera is my worst enemy