TBGL_EntityGetMatrix* by Joshy
issueid=73 06-03-2010 07:27
Number of reported issues by D.J.Peters: 7
TBGL_EntityGetMatrix* by Joshy


TBGL_EntitySetMatrix4x4(byval SceneID, byval EntityID, byref Array4x4 [,Order])
TBGL_EntityGetMatrix4x4(byval SceneID, byval EntityID, byref Array4x4 [,Order])

TBGL_EntitySetMatrix3x3(byval SceneID, byval EntityID, byref Array3x3 [,Order])
TBGL_EntityGetMatrix3x3(byval SceneID, byval EntityID, byref Array3x3 [,Order])

in most cases the data type of matrix should be float not double

thank you

Issue Details
Issue Number 73
Issue Type Feature
Project TBGL
Category Unknown
Status Implemented
Priority Unknown
Suggested Version Unknown
Implemented Version (none)
Votes for this feature 0
Votes against this feature 0
Assigned Users (none)
Tags (none)

06-03-2010 10:16
Super Moderator
Hi Joshy,

I split this topic so I have one request in one thread, much easier to follow.
As I said, TBGL_EntityGetMatrix awaits you in next update.

These special syntax variants are interesting, I will consider them for 2.x release of TB.

The thing is that thinBASIC SDK allows you to detect how many elements the passed array has, so maybe just single function for Get and Set will be necessary.


08-03-2010 09:53
Super Moderator
By row-column you mean the matrix will be:

Xx, Xy, Xz, 0
Yx, Yy, Yz, 0
Zx, Zy, Zz, 0
Px, Py, Pz, 1

And column-row this?:

Xx, Yx, Zx, Px
Xy, Yy, Zy, Py
Xz, Yz, Zz, Pz
0, 0, 0, 1

The 4x4 set/get matrix functions might make it to 1.8, but I would need help from you in form of intensive testing. Otherwise I will leave it for 2.x.

For 3x3, I presume they would hold "local x,y,z axes" only?


08-03-2010 10:35
2D arrays in C/C++ have an other order as in most BASIC languages.
(of course 1D arrays are allways the same :lol: )

array(3,3) ' BASIC
1,1, 1,2, 1,3 = address in memory 0,1,2
2,1, 2,2, 2,3 = address in memory 3,4,5
3,1, 3,2, 3,3 = address in memory 6,7,8

array[3,3] ' C
1,1, 2,1, 3,1 = address in memory 0,3,6
1,2, 2,2, 3,2 = address in memory 1,4,7
1,3, 2,3, 3,3 = address in memory 2,5,8

Is TBGL written in C/C++ or Power/Free BASIC ?


08-03-2010 10:40
Super Moderator

it is powerBasic powered.

Here is the updated DLL.

It should support Get/Set for both 4x4 and 3x3 matrices, the command detects the size of array automagically.

How to use? Few examples:
Dim Matrix4by4(4,4) As Single
Dim Matrix3by3(3,3) As Single

' -- Pass matrix 4x4 in row-col order
TBGL_EntityGetMatrix(%sScene, %eBox, Matrix4by4(1, 1), %TBGL_RowColumn)

' -- Pass matrix 4x4 in col-row order
TBGL_EntityGetMatrix(%sScene, %eBox, Matrix4by4(1, 1), %TBGL_ColumnRow)

' -- Pass matrix 3x3 in row-col order
TBGL_EntityGetMatrix(%sScene, %eBox, Matrix3by3(1, 1), %TBGL_RowColumn)

' -- Pass matrix 3x3 in col-row order
TBGL_EntityGetMatrix(%sScene, %eBox, Matrix3by3(1, 1), %TBGL_ColumnRow)
... and the same for Set.

I am reallocating to uni, so I will be able to react back later today.

I would appreciate your tests, if ok, then I will document it and add to 1.8


08-03-2010 20:39
Super Moderator
Feature developed and documented,
will be present in ThinBASIC 1.8.

+ Reply