Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / HOW DO MEMBLOCKS WORK?

Author
Message
Wanja
21
Years of Service
User Offline
Joined: 28th Aug 2002
Location:
Posted: 24th Sep 2002 03:27
could anyone explain me this memblock thingy? How do I get for example XYZ data into it. what's a Dword.. the manual seems really poor....HELP
Wanja
21
Years of Service
User Offline
Joined: 28th Aug 2002
Location:
Posted: 24th Sep 2002 04:18
I also get an error like: memblock range illegal
what am I doing wrong?

Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Sep 2002 04:40
well the manual shows you what the data setup is, however not to easily read it...
Now i've checked the Trial Pro Manual (if it is any different from the retail) and it no longer describes the mesh creation data setup.

From Original DB 1.1x Manual
Memblock-Mesh (32 Byte Header)
-Header
--4 BYTES (DWORD) Number Of Vertices
--4 BYTES (DWORD) Offset in Bytes to Vertice Data
--4 BYTES (DWORD) Number Of Normals
--4 BYTES (DWORD) Offset in Bytes to Normals Data
--4 BYTES (DWORD) Number of Faces
--4 BYTES (DWORD) Offset in Bytes to Face Data
--4 BYTES (DWORD) Size Of All Face Data
--4 BYTES (DWORD) Offset in Bytes to Texture UV Data
-Data
--Vertice Data
---For Each Vertex
----4 BYTES (FLOAT) - X Position of 3D Geometry
----4 BYTES (FLOAT) - Y Position of 3D Geometry
----4 BYTES (FLOAT) - Z Position of 3D Geometry
--Normals Data
---For Each Normal
----4 BYTES (FLOAT) - X Normalised Normal of 3D Geometry
----4 BYTES (FLOAT) - Y Normalised Normal of 3D Geometry
----4 BYTES (FLOAT) - Z Normalised Normal of 3D Geometry
--Face Data
---For Each Face (a face makes a polygon using A,B and C as vector points)
----2 BYTES (DWORD) - Number of Vectors in Face (always use 3)
----2 BYTES (DWORD) - Index to Vertex in Vertex Data for Vector A
----2 BYTES (DWORD) - Index to Normal in Vertex Data for Vector A
----2 BYTES (DWORD) - Index to Vertex in Vertex Data for Vector B
----2 BYTES (DWORD) - Index to Normal in Vertex Data for Vector B
----2 BYTES (DWORD) - Index to Vertex in Vertex Data for Vector C
----2 BYTES (DWORD) - Index to Normal in Vertex Data for Vector C
--Texture Data
---For Each Vertex
----4 BYTES (FLOAT) - U Value of Texture
----4 BYTES (FLOAT) - V Value of Texture

now to read this data for manipulation and such all you need to do is setup the position of data you need to read and change ... becuase the function is
[value] = read memblock [data type]([memblock],[position])
I've linked an uploaded debugger ... should show howto use them quite quickly and effenciently
http://members.lycos.co.uk/TimeSaga/darkbasic/meshdebug.dba

Hope this helps

"For the Greater Good"...
Kyi'Aun (Jedi Master) Rai'Ka
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Sep 2002 04:47
As for the values DB uses ...
Data Description Size Value Range
Byte | 8-Bit Value | 1Byte | 0 - 255
Word | 16-Bit Value | 2Bytes | 0 - 65535
Dword| 32-Bit Value | 4Bytes | 0 - 2147483648
Float| 32-Bit Float | 4Byte | -2147483648 - 2147483648

Float Values are special as not only can you have negative values but unlike the rest they are REAL number instead of intergers...
10 is an interger and 10.0 is a float Hope that seems simple enough

(ps i noticed id used float instead of dword for the faces, i've uploaded the fixxed version)

"For the Greater Good"...
Kyi'Aun (Jedi Master) Rai'Ka
Wanja
21
Years of Service
User Offline
Joined: 28th Aug 2002
Location:
Posted: 24th Sep 2002 11:34
Great thanx this is a real good examples

I think I got it now

Login to post a reply

Server time is: 2024-04-19 09:53:23
Your offset time is: 2024-04-19 09:53:23