Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 02:40 09 Dec 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 DRAW3D Function - Is it obsolete?

Author Message
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1070
Posted: 09:47pm 07 Dec 2025
Copy link to clipboard 
Print this post

I am working on the CMM2 code. I have found the DRAW3D Function in the code. It is not mentioned in the CMM2 3D Engine PDF and a search on TBS found only this thread that reference to it. I extracted the example program and it is below.
The DRAW3D function errors on the current released Version 5.07.01 and also on all the latest betas I tried.
Is the DRAW3D function obsolete, can I removed it.

Example using DRAW3D Function


option explicit
option default float
dim integer viewplane = 500
const camera = 1
dim q(4)
dim yaw=rad(1),pitch=rad(2),roll=rad(0.5)
dim integer nv=9, nf=9 ' cube has 9 vertices and 9 faces
'array to hold vertices
dim v(2,nv-1)=(-1,1,-1, 1,1,-1, 1,-1,-1, -1,-1,-1, -1,1,1, 1,1,1, 1,-1,1, -1,-1,1, 0,0,0)
math scale v(),200,v()
' array to hold number of vertices for each face
dim integer fc(nf-1) =(4,4,4,4,4,3,3,3,3)
dim integer cindex(9)=(rgb(red),rgb(blue),rgb(green),rgb(magenta),rgb(yellow),rgb(cyan),rgb(white),rgb(brown),rgb(gray),0)
dim integer fcol(nf-1)=(9,9,9,9,9,9,9,9,9)
dim integer bcol(nf-1)=(0,1,2,3,4,5,6,7,8)
'array to hold vertices for each face
dim integer fv(math(sum fc())-1)=(1,5,6,2, 1,0,4,5, 0,3,7,4, 5,4,7,6, 2,6,7,3, 0,1,8, 1,2,8, 3,8,2 , 3,0,8)
draw3d create 1, nv, nf, camera, v(), fc(), fv(),cindex(),fcol(),bcol()
dim integer c
page write 1
draw3d camera 1,viewplane, mm.hres\2, mm.vres\2
do
for c=0 to 720
timer=0
math q_create roll,1,1,1,q()
draw3d show 1,mm.hres\2,mm.vres\2,1000
' math q_euler yaw,pitch,roll,q()
draw3d rotate q(),1
print @(0,0)draw3d(XMIN 1),@(64)draw3d(xmax 1),@(128)draw3d(ymin 1),@(192)draw3d(ymax 1)
' inc yaw,rad(1)
' inc pitch,rad(2)
inc roll,rad(0.5)
page copy 1 to 0,b
next
loop
draw3d close all


F4 H7FotSF4xGT
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10684
Posted: 12:26pm 08 Dec 2025
Copy link to clipboard 
Print this post

It should be there and should work. The bug is in allcommands,h where the definitions is for it to return an int and it actually returns a float

{ "DRAW3D(",    T_FUN | T_INT, 0, fun_3D,    },


should be

{ "DRAW3D(",    T_FUN | T_NBR, 0, fun_3D,    },


In the example it is used to demonstrate how it could be used to define an area to be erased before re-drawing
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025