[Legacy] Xors3D for PureBasic
- Guevara-chan
- User
- Posts: 13
- Joined: Sat Jun 18, 2011 12:20 pm
[Legacy] Xors3D for PureBasic
Not so sure if someone gonna still use this (abandonware, after all), yet why exactly not ?..
...Well, since I managed to refresh my memory about having GitHub, there - https://github.com/Guevara-chan/Xors3D-for-PB . Download archive, unzip to your favorite project's dir and read:
; <Sum>:
Xors3D is an abandoned 3D graphics engine, easily accessible from almost any programming language through transparent procedural interface. It was initially developed by XorsTeam in attempt of bringing DirectX9 functionality into Blitz3D. Discounted since 2012.
Xors3D for PureBasic was one of first pre-official wrappers, reconstructed directly from Blitz3D headers.
Just XIncludeFile "Xors3D.pbi" to hook it up - maximum transparency, PB style.
; <Featurae>:
~> 69 original Xors3D samples, translated from different sources to PureBasic.
~> Latest salvageable engine revision: 1.15.750.0
~> Dynamical prototype-based bindings.
~> XCopy-based installation.
; <Breakdown>:
Graphix: DirectX: 9.0c (d3dx9_36.dll+ required)
Physix: integrated (xPhysics v1.15.750.0)
Audio: Squall sound system (version unknown)
; <Sample imaging>:
...Well, since I managed to refresh my memory about having GitHub, there - https://github.com/Guevara-chan/Xors3D-for-PB . Download archive, unzip to your favorite project's dir and read:
; <Sum>:
Xors3D is an abandoned 3D graphics engine, easily accessible from almost any programming language through transparent procedural interface. It was initially developed by XorsTeam in attempt of bringing DirectX9 functionality into Blitz3D. Discounted since 2012.
Xors3D for PureBasic was one of first pre-official wrappers, reconstructed directly from Blitz3D headers.
Just XIncludeFile "Xors3D.pbi" to hook it up - maximum transparency, PB style.
; <Featurae>:
~> 69 original Xors3D samples, translated from different sources to PureBasic.
~> Latest salvageable engine revision: 1.15.750.0
~> Dynamical prototype-based bindings.
~> XCopy-based installation.
; <Breakdown>:
Graphix: DirectX: 9.0c (d3dx9_36.dll+ required)
Physix: integrated (xPhysics v1.15.750.0)
Audio: Squall sound system (version unknown)
; <Sample imaging>:
life MOV.I #life+1, *life
האם יש זמן לעצור ?
האם יש זמן לעצור ?
Re: [Legacy] Xors3D for PureBasic
... without a valid license key there is a 30min timelimit and you can't disable the startlogo!Not so sure if someone gonna still use this (abandonware, after all), yet why exactly not ?..
For what it's worth, I uploaded my version of the wrapper (incl. FastImage) here
Et cetera is my worst enemy
- Guevara-chan
- User
- Posts: 13
- Joined: Sat Jun 18, 2011 12:20 pm
Re: [Legacy] Xors3D for PureBasic
…Or something. Whatever:
Insert those 2 lines above xGraphics(3D) to solve vast majority of your logo problems. Just trust me there.
As for license, keys and other legal stuff – that’s quite a story on it’s own. Kinda reminds me of how and why (except boredom, ‘course) I started those micro-project. First of all, chi – do you aware about their free giveaways back then ?
P.S. Why army, btw ? There was much more edgier^W representative samples.
Code: Select all
xSetEngineSetting("Splash::TilingTime", "0.0")
xSetEngineSetting("Splash::AfterTilingTime", "0.0")
As for license, keys and other legal stuff – that’s quite a story on it’s own. Kinda reminds me of how and why (except boredom, ‘course) I started those micro-project. First of all, chi – do you aware about their free giveaways back then ?
P.S. Why army, btw ? There was much more edgier^W representative samples.
life MOV.I #life+1, *life
האם יש זמן לעצור ?
האם יש זמן לעצור ?
Re: [Legacy] Xors3D for PureBasic
Those 2 lines only work in combination with a license key (bought mine 2010 btw). My statement about the time limit and logo were intended for the people without a key.
Don't get me wrong here... I used to love Xors3d! It was a pretty good engine back then (maybe still is) and I only stopped using it because Squid abandoned the project without making it open source (still hope he's alright, though). Since no one could alter the code, it wasn't working for me anymore and so I switched to Unity.
Why army? Because I was (am) lazy and...
cheers, chi
edit: To fix the missing alpha channel on the image -> devil = xLoadImageEx(".\media\Devil.png", #FLAGS_ALPHA)
Don't get me wrong here... I used to love Xors3d! It was a pretty good engine back then (maybe still is) and I only stopped using it because Squid abandoned the project without making it open source (still hope he's alright, though). Since no one could alter the code, it wasn't working for me anymore and so I switched to Unity.
Why army? Because I was (am) lazy and...
cheers, chi
edit: To fix the missing alpha channel on the image -> devil = xLoadImageEx(".\media\Devil.png", #FLAGS_ALPHA)
Et cetera is my worst enemy
- Guevara-chan
- User
- Posts: 13
- Joined: Sat Jun 18, 2011 12:20 pm
Re: [Legacy] Xors3D for PureBasic
Chi, when I tell someone to trust me – they just expected to. It’s rather unlikely for non-believers to be saved from mirk horros of Xors’ omnipresent self-insertion.
As for Squid – nice guy those Squid is. Heck, noticed him at first time as one of few relatively brave souls who tried to take my side during last conflict with administrator of (now demised, thanks god) Blitz.pp.ru back in 2007. That being said, while Squid was all cute and public person, lead of their team always belonged to Knightmare... who still is pretty much alive and kicking, unfortunately^W. So yeah, no source codes in determinable future for sure.
Yet even with all of this, I fail to see better options for PB’s gaming future. Sad, but true.
As for Squid – nice guy those Squid is. Heck, noticed him at first time as one of few relatively brave souls who tried to take my side during last conflict with administrator of (now demised, thanks god) Blitz.pp.ru back in 2007. That being said, while Squid was all cute and public person, lead of their team always belonged to Knightmare... who still is pretty much alive and kicking, unfortunately^W. So yeah, no source codes in determinable future for sure.
Yet even with all of this, I fail to see better options for PB’s gaming future. Sad, but true.
life MOV.I #life+1, *life
האם יש זמן לעצור ?
האם יש זמן לעצור ?
Re: [Legacy] Xors3D for PureBasic
thank you Guevara-chan and chi for posting the wrapper, and making it works for purebasic 5.31
any additions to the purebasic are great, there is no abandoned or deprecated, everything can be used, this is why the museums are there
my only concern is plotting points, when drawing Julia set for iterations = 3000000 it seems speedy, it is may be using a single precision numbers only like blitz3D, just a guess.
how to know which version is this engine ?
here is the Julia Plotting program i post it again: (in line 30 change mand = 0 to mand = 1 to plot mandelbrot set.
any additions to the purebasic are great, there is no abandoned or deprecated, everything can be used, this is why the museums are there
my only concern is plotting points, when drawing Julia set for iterations = 3000000 it seems speedy, it is may be using a single precision numbers only like blitz3D, just a guess.
how to know which version is this engine ?
here is the Julia Plotting program i post it again: (in line 30 change mand = 0 to mand = 1 to plot mandelbrot set.
Code: Select all
SetCurrentDirectory("..\..\dll") : XIncludeFile "..\..\xors3d.pbi" ; Essential.
SetCurrentDirectory("..\")
;XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d.pbi"
;XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d_FastImage.pbi"
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(5000000) ; 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 = 0
;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
xSetEngineSetting("Splash::TilingTime", "0.0")
xSetEngineSetting("Splash::AfterTilingTime", "0.0")
xGraphics3D( 800, 600, 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 = 3000000
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
Re: [Legacy] Xors3D for PureBasic
I never understood Fred's decision why he picked Ogre over Irrlicht in the first placeGuevara-chan wrote:Yet even with all of this, I fail to see better options for PB’s gaming future. Sad, but true.
Right click over Xors3d.dll / Properties / Details... It's the last public release 1.15.750.0applePi wrote:how to know which version is this engine ?
edit:
Oh, now I see what you did... bad boyGuevara-chan wrote:Chi, when I tell someone to trust me – they just expected to. It’s rather unlikely for non-believers to be saved from mirk horros of Xors’ omnipresent self-insertion.
Et cetera is my worst enemy
Re: [Legacy] Xors3D for PureBasic
Et cetera is my worst enemy
Re: [Legacy] Xors3D for PureBasic
have anyone a buglist for xors3d?
Re: [Legacy] Xors3D for PureBasic
occasionally i experiment with xors3d, here is some notes:
xSaveMesh saves the mesh to .fbx format. we can convert .fbx format to .OBJ easily with this utility: Autodesk FBX Converter 2013: http://usa.autodesk.com/adsk/servlet/pc ... d=22694909
this enables us to print our graphics in purebasic with a 3D printer which use stl and obj formats as an input
let us make a test: save this code to the folder \Xors3D-for-PB-master\Samples\Basic
and while running press 'S' key, the knot.fbx is created in the \Xors3D-for-PB-master\DLL folder
how to use Autodesk FBX Converter:
to view your file knot.fbx
Tools -> add fbx viewer
File -> choose your file
=======================
to convert the file to Obj or DXF or DAE collada
Tools -> add fbx converter
Add -> choose your fbx file
Destination Format -> Obj ,DXF, DAE collada
Convert
regarding the mesh deformation, we only need this function: xVertexCoords(surface, vertex index, x,y,z) to change the position of any vertex.
press the arrow keys to change the upper triangle vertex positions:
to add vertices and triangles in the run time: downlod these 2 codes, the first one add triangles and the second add spheres. save them to \Xors3D-for-PB-master\Samples\Basic
http://www.mediafire.com/file/tu3vo8848 ... angles.rar
better to run all the xors3d example in non unicode mode with PB 5.44 32/bit
and your computer should have directX 9 installed. or install it from : http://download.microsoft.com/download/ ... redist.exe
xSaveMesh saves the mesh to .fbx format. we can convert .fbx format to .OBJ easily with this utility: Autodesk FBX Converter 2013: http://usa.autodesk.com/adsk/servlet/pc ... d=22694909
this enables us to print our graphics in purebasic with a 3D printer which use stl and obj formats as an input
let us make a test: save this code to the folder \Xors3D-for-PB-master\Samples\Basic
and while running press 'S' key, the knot.fbx is created in the \Xors3D-for-PB-master\DLL folder
how to use Autodesk FBX Converter:
to view your file knot.fbx
Tools -> add fbx viewer
File -> choose your file
=======================
to convert the file to Obj or DXF or DAE collada
Tools -> add fbx converter
Add -> choose your fbx file
Destination Format -> Obj ,DXF, DAE collada
Convert
Code: Select all
SetCurrentDirectory("..\..\dll")
; Include header file
IncludeFile "..\..\xors3d.pbi"
xCreateLog()
; setup maximum supported AntiAlias Type
xSetAntiAliasType(xGetMaxAntiAlias())
; set application window caption
xAppTitle("Make a Mesh + Physics sample. W: wirerame. Space: stop rotation. arrows: move camera. S saves the mesh")
; initialize graphics mode
xSetEngineSetting("Splash::TilingTime", "0.0")
xSetEngineSetting("Splash::AfterTilingTime", "0.0")
xGraphics3D(800, 600, 32, #False, #True)
; hide mouse pointer
;xHidePointer()
; enable antialiasing
xAntiAlias(#True)
#CameraSpeed = 0.5
#NUM_BANDS = 16 ;number of points every circle (band) on the tube made from
#BAND_RAD = 2 ;tube thickness
Define.f KeyX, KeyY, MouseX, MouseY
Global rot = 1
Global rings
Global NbX = #NUM_BANDS
Global NbZ
Global tot
Structure vector3d
x.f
y.f
z.f
EndStructure
Global.l NUM_RINGS, NUM_BANDS
Global.f BAND_RAD, txu, txv
NUM_BANDS = 16
BAND_RAD = 3 ; tube thickness
Declare MakeTube(Rings.l, Bands.l, BandRadius.f)
Quit.b = #False
Procedure.f RandF(Min.f, Max.f, Resolution.i = 10000)
ProcedureReturn (Min + (Max - Min) * Random(Resolution) / Resolution)
EndProcedure
Global.l P1, P2, P3, P4,light, mesh, surf, cam, i, v1, v2, v3, brush, tri1, tot
Global.l light, mesh, surf, cam, i, brush, tri1, sphere
Global Texture, logoTexture, ground
xAntiAlias(#True)
light = xCreateLight(1)
mesh = xCreateMesh ()
xMeshPrimitiveType (mesh, 4)
surf = xCreateSurface(mesh, brush)
xSurfacePrimitiveType (surf, 4)
xRotateEntity(mesh, 90,0,0)
MakeTube (NUM_RINGS, NUM_BANDS, BAND_RAD)
Texture = xLoadTexture("..\media\textures\blue_marble.jpg")
xEntityTexture(mesh,Texture,0,0)
xPositionEntity(mesh, 0,30,0)
camera = xCreateCamera(0)
; // position camera
xPositionEntity(camera, 0, 60, -70, #False)
ground = xCreateCube()
xPointEntity(camera, ground, 0.0)
xScaleEntity(ground, 100, 1, 100, #False)
xEntityAddBoxShape(ground, 0.0, 0.0, 0.0, 0.0)
;loading logo from File
logoTexture = xLoadTexture("..\media\textures\logo.jpg")
; texture cube
xEntityTexture(ground, logoTexture)
; // texture ground box
xEntityTexture(ground, logoTexture, 0, 0)
light = xCreateLight(0)
xRotateEntity(light, 45, 0, 0, #False)
sphere = xCreateSphere(16, 0)
xScaleMesh(sphere,2,2,2)
xPositionEntity(sphere, -5,40,-5)
xEntityColor(sphere, 255, 0, 0)
xEntityAddSphereShape(sphere, 20.0, 0.0)
xEntityAddConcaveShape(mesh, 0)
xFlipMesh(mesh)
xEntityFX(mesh, 1|2|16) ; make the mesh texture brighter
xUpdateNormals(mesh)
xPointEntity(camera, mesh)
mv.f = 0.6
wireframe=0: turn = 1
;====================================================================
;xSaveMesh(mesh,"knot3")
; main program loop
While(Not (xKeyHit(#KEY_ESCAPE) Or xWinMessage("WM_CLOSE")))
; camera control
If xKeyDown(#KEY_Up)
xMoveEntity(camera, 0, 0, mv, #False)
EndIf
If xKeyDown(#KEY_Down)
xMoveEntity(camera, 0, 0, -mv, #False)
EndIf
If xKeyDown(#KEY_Left)
xMoveEntity(camera, -mv, 0, 0, #False)
EndIf
If xKeyDown(#KEY_Right)
xMoveEntity(camera, mv, 0, 0, #False)
EndIf
If xKeyHit(#xKEY_W)
If wireframe = 1
wireframe = 0
Else
wireframe = 1
EndIf
xWireframe(wireframe)
ElseIf xKeyHit(#xKEY_Space)
If turn = 1
turn = 0
Else
turn = 1
EndIf
EndIf
If xKeyHit(#xKEY_s)
xSaveMesh(mesh, "knot")
EndIf
xTurnEntity(mesh, 0, 0, turn/4)
;// RENDER scene
xUpdateWorld(1.0)
xRenderWorld(1.0, 0)
; // FPS & rendered triangles counters
xText(10, 10, "FPS: " + xGetFPS())
xText(10, 30, "Tri: " + Str(xCountTriangles(surf)))
xFlip()
Wend
;xReleaseGraphics()
Procedure vector_cross(*v1.vector3d, *v2.vector3d, *vout.vector3d)
*vout\x = (*v1\y * *v2\z) - (*v2\y * *v1\z)
*vout\y = (*v1\z * *v2\x) - (*v2\z * *v1\x)
*vout\z = (*v1\x * *v2\y) - (*v2\x * *v1\y)
EndProcedure
Procedure.f vector_magnitude(*v.vector3d)
mag.f
mag = Sqr(*v\x * *v\x + *v\y * *v\y + *v\z * *v\z)
If mag = 0:mag = 1:EndIf
ProcedureReturn mag
EndProcedure
Procedure vector_normalize (*v.vector3d)
mag.f
mag = vector_magnitude(*v)
*v\x = *v\x / mag
*v\y = *v\y / mag
*v\z = *v\z / mag
EndProcedure
Procedure vector_add (*v1.vector3d, *v2.vector3d, *vout.vector3d)
*vout\x = *v1\x + *v2\x
*vout\y = *v1\y + *v2\y
*vout\z = *v1\z + *v2\z
EndProcedure
Procedure vector_sub (*v1.vector3d, *v2.vector3d, *vout.vector3d)
*vout\x = *v1\x - *v2\x
*vout\y = *v1\y - *v2\y
*vout\z = *v1\z - *v2\z
EndProcedure
;main Procedure To calculate the tube
Procedure MakeTube (Rings.l , Bands.l ,BandRadius.f)
Protected.f x,y,z
Protected.l rr,gg,bb, i, RingsTotal, v1
Protected.f angle, radius, increm, upp, mag
angle = 0
Increm = 0.01
;--------------------------------
RingsTotal.l = 0 ; number of rings For the final mesh
Define next_point.vector3d
Define current_point.vector3d
Define T.vector3d
Define N.vector3d
Define B.vector3d
While angle <= 2*#PI - 0.1
RingsTotal + 1
angle + Increm
;center point
current_point\x = 0.1*(41 *Cos(angle) - 18 *Sin(angle) - 83 *Cos(2 *angle) - 83 *Sin(2 *angle) - 11 *Cos(3 *angle) + 57 *Sin(3 *angle))
current_point\y = 0.1*(36 *Cos(angle) + 27 *Sin(angle) - 113 *Cos(2 *angle) + 30 *Sin(2 *angle) + 11 *Cos(3 *angle) - 57 *Sin(3 *angle))
current_point\z = 0.1*(45 *Sin(angle) - 30 *Cos(2 *angle) + 113 *Sin(2 *angle) - 11 *Cos(3 *angle) + 27 *Sin(3 *angle))
;radius = a1 + b1*angle'+0.1
angle = angle + increm
;upp = upp + 0.2
;Next Point (For Frenet square Method)
next_point\x = 0.1*(41 *Cos(angle) - 18 *Sin(angle) - 83 *Cos(2 *angle) - 83 *Sin(2 *angle) - 11 *Cos(3 *angle) + 57 *Sin(3 *angle))
next_point\y = 0.1*(36 *Cos(angle) + 27 *Sin(angle) - 113 *Cos(2 *angle) + 30 *Sin(2 *angle) + 11 *Cos(3 *angle) - 57 *Sin(3 *angle))
next_point\z = 0.1*(45 *Sin(angle) - 30 *Cos(2 *angle) + 113 *Sin(2 *angle) - 11 *Cos(3 *angle) + 27 *Sin(3 *angle))
;angle = angle + increm
;upp = upp + 0.2
;T = P' - P
vector_sub(next_point, current_point, T)
;N = P' + P
vector_add(next_point, current_point, N)
;B = T x N
vector_cross(T, N, B)
;N = B x T
vector_cross(B, T, N)
;Normalize vectors Or Else it won't work
vector_normalize(B)
vector_normalize(N)
j.l = 0
For j = 0 To bands
new_point_x.f
new_point_y.f
;rotate around the current point using normal rotation makes bands
new_point_x = Sin(j * 2*#PI / bands) * BAND_RAD
new_point_y = Cos(j * 2*#PI / bands) * BAND_RAD
;this is the coords of our point along the curve
x = N\x * new_point_x + B\x * new_point_y + current_point\x
y = N\y * new_point_x + B\y * new_point_y + current_point\y
z = N\z * new_point_x + B\z * new_point_y + current_point\z
;rr=RND(0,255):gg=RND(0,255):bb=RND(0,255)
v1 = xAddVertex(surf, x, y, z, txu, txv,0)
;xVertexColor(surf, v1, rr, gg, bb, 1)
txv = txv + 1/bands
Next
;rr=Rnd(0,255):gg=Rnd(0,255):bb=Rnd(0,255)
txv = 0
txu = txu + 1/bands
Wend
c.l = 0
d.l = 0
Protected.l P1, P2, P3, P4
For d=0 To RingsTotal-2
For c=0 To NUM_BANDS-1
P1=c+(d*(NUM_BANDS+1))
P2=P1+1
P3=c+(d+1)*(NUM_BANDS+1)
P4=P3+1
tri1 = xAddTriangle(surf, P3, P2, P1)
tri1 = xAddTriangle(surf, P2, P3, P4)
tot + 1
Next
Next
EndProcedure
press the arrow keys to change the upper triangle vertex positions:
Code: Select all
SetCurrentDirectory("..\..\dll")
; Include header file
IncludeFile "..\..\xors3d.pbi"
xCreateLog()
; setup maximum supported AntiAlias Type
xSetAntiAliasType(xGetMaxAntiAlias())
; set application window caption
xAppTitle("Example Xors3D: Press Arrow Keys to deform the triangle in real time (changing upper vertex position")
; initialize graphics mode
xSetEngineSetting("Splash::TilingTime", "0.0")
xSetEngineSetting("Splash::AfterTilingTime", "0.0")
xGraphics3D(800, 600, 32, #False, #True)
; hide mouse pointer
;xHidePointer()
; enable antialiasing
xAntiAlias(#True)
Global.l light, mesh, surf, cam, i, v1, v2, v3, brush, tri1, tot
Global.f x,y,z,r,g,b
light = xCreateLight(1)
mesh = xCreateMesh ()
xMeshPrimitiveType (mesh, 4)
surf = xCreateSurface(mesh, brush)
xSurfacePrimitiveType (surf, 4)
tot+1
v1 = xAddVertex(surf, -50, -50, 0, 0, 1)
xVertexColor(surf, v1, 0, 0, 255, 1)
v2 = xAddVertex(surf, 50, -50, 0, 0, 1)
xVertexColor(surf, v2, 0, 255, 0, 1)
v3 = xAddVertex(surf, 0, 50, 0, 0, 1)
xVertexColor(surf, v3, 255, 0, 0, 1)
tri1 = xAddTriangle(surf, v1, v2, v3)
;creating the camera
cam = xCreateCamera()
xPositionEntity(mesh, 0,0,400)
xPositionEntity(cam, 0, 0, 0)
;xPointEntity(cam, mesh) ; let the camera look always to the mesh
xFlipMesh(mesh)
xEntityFX(mesh, 1|2|18)
xUpdateNormals(mesh)
y.f=50 : x.f = 0
While(Not (xKeyHit(#KEY_ESCAPE) Or xWinMessage("WM_CLOSE")))
If xKeyDown(#KEY_Up)
y+0.5
xVertexCoords(surf, 2, x,y,0)
ElseIf xKeyDown(#KEY_Down)
y-0.5
xVertexCoords(surf, 2, x,y,0)
ElseIf xKeyDown(#KEY_Left)
x-0.5
xVertexCoords(surf, 2, x,y,0)
ElseIf xKeyDown(#KEY_right)
x+0.5
xVertexCoords(surf, 2, x,y,0)
EndIf
;xTurnEntity(mesh, 0, 1, 0)
xRenderWorld()
xText(10, 10, "FPS: " + xGetFPS())
xText(10, 30, "Tri: " + Str(xCountTriangles(surf)))
xFlip()
Wend
End
http://www.mediafire.com/file/tu3vo8848 ... angles.rar
better to run all the xors3d example in non unicode mode with PB 5.44 32/bit
and your computer should have directX 9 installed. or install it from : http://download.microsoft.com/download/ ... redist.exe
Re: [Legacy] Xors3D for PureBasic
Don't know if anyone is still using Xord3d, but I removed the annoying splash screen introduced with Revision 750... For PB <= v5.4x (Ascii) PbXors3d_750.zip
Et cetera is my worst enemy
Re: [Legacy] Xors3D for PureBasic
Thank you.chi wrote:Don't know if anyone is still using Xord3d, but I removed the annoying splash screen introduced with Revision 750... For PB <= v5.4x (Ascii) PbXors3d_750.zip
Best wishes to the PB community. Thank you for the memories.
Re: [Legacy] Xors3D for PureBasic
Thanks chi for the update, it makes the life easier while trying examples and demos. i have found that the old xors3d page for blitzBasic is now archived here with pictures, the pictures gives an idea about the engine features : http://mojolabs.nz/posts.php?topic=106322
there is also tutorials in German about xors3d for blitz3d which astonishingly can run in purebasic with very few changes
i have a few questions:
** here https://github.com/vadya53/ixor3d there is ixor3d, what is the difference with xors3d provided here for purebasic.
** regarding displaying the colored points in xors3d in general and in this example:
why i need to write: xAddTriangle(surf, 0, 0, 0) after defining the points cloud mesh using many xAddVertex and xVertexColor . even the mesh and suface defined as pointsList:
adding xAddTriangle(surf, 0, 0, 0) is meaningless for the points list but the points does not displayed untill i add just one xAddTriangle(surf, 0, 0, 0).
i will try to register in that forum and will post some questions if the questions possible there.
there is also tutorials in German about xors3d for blitz3d which astonishingly can run in purebasic with very few changes
i have a few questions:
** here https://github.com/vadya53/ixor3d there is ixor3d, what is the difference with xors3d provided here for purebasic.
** regarding displaying the colored points in xors3d in general and in this example:
Code: Select all
XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d.pbi"
;XIncludeFile #PB_Compiler_Home + "\Compilers\Xors3d_FastImage.pbi"
xGraphics3D( 640, 480, 32, #False, #True)
mesh = xCreateMesh ()
xMeshPrimitiveType (mesh, 1)
surf = xCreateSurface(mesh, brush)
xSurfacePrimitiveType (surf, 1)
For i=0 To 20000
x = Random(200)-100:y = Random(200)-100:z = Random(200)-100
;(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)) <= 10000;4900
r=255:g=119:b=119
v = xAddVertex(surf, x, y, z, 0, 1)
xVertexColor(surf, v, r, g, b, 1)
EndIf
Next
xAddTriangle(surf, 0, 0, 0)
;creating the camera
cam = xCreateCamera()
xPositionEntity(mesh, 0,0,0)
xPositionEntity(cam, 0, 0, -500)
xEntityFX(mesh, 2|1)
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
mesh = xCreateMesh ()
xMeshPrimitiveType (mesh, 1)
surf = xCreateSurface(mesh, brush)
xSurfacePrimitiveType (surf, 1)
i will try to register in that forum and will post some questions if the questions possible there.
Re: [Legacy] Xors3D for PureBasic
yup, was pretty annoyingapplePi wrote:Thanks chi for the update, it makes the life easier while trying examples and demos.
Maybe usefull too: Xors3dIndie(withSamples)_750.zip (vanilla)applePi wrote:i have found that the old xors3d page for blitzBasic is now archived here with pictures, the pictures gives an idea about the engine features : http://mojolabs.nz/posts.php?topic=106322
there is also tutorials in German about xors3d for blitz3d which astonishingly can run in purebasic with very few changes
iXors3d is/was for iPhones... Never had one, never tried itapplePi wrote:** here https://github.com/vadya53/ixor3d there is ixor3d, what is the difference with xors3d provided here for purebasic.
Because without xAddTriangle there is only the mesh surface, which is not able to render (Doc: Surfaces are sections of mesh which are then used to attach triangles to).applePi wrote:why i need to write: xAddTriangle(surf, 0, 0, 0) after defining the points cloud mesh...
Et cetera is my worst enemy