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.

Newcomers DBPro Corner / 3D Model Viewer

Author
Message
3D Scientifics
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 29th Nov 2004 01:07
I would like to create a simple 3D Model viewer with Zoom, Pan and Rotate functions. I would like to load .MD2 or .3DS models with it also. I have Dark Basic PRO.

Are there any good examples out there of this? The closest thing I could fine is the Pick Object example but it's not quite what I want.

I appreciate your help.

Thanks!
Chris
IanG
19
Years of Service
User Offline
Joined: 25th Sep 2004
Location: Cyberspace
Posted: 29th Nov 2004 04:09
what you having problems with

load the model up

then pan is moving the camera from side to side, zoom is moving it closer and rotate is just rotating around the origin (or if you have easy rotate you can use the orbit function)

Used to be Phoenix_insane registered in september 2003 despite what the date says to the left <--
PC - amd athlon 2.0ghz, 512mb, GeForce FX 5200 128mb, 200gb, xp pro sp2
sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 30th Nov 2004 12:26
here one I got most of the code from yellow/Mike s. you will have to take out my bitmap code, it work soso.
renny
3D Scientifics
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 5th Dec 2004 07:55
I got something fairly decent worked out. It maps an earthimage onto a sphere and lets you rotate/zoom in/zoom out. I have posted the app (3DEarthView) free at my site: www.3dscientifics.com - you can get the earth image there.

I don't know how to get the text to stop flashing, also I would like the lightsource to stay up and behind the viewers shoulder. I would appreciate any help. this is for educational freeware.

Here is the code so far as of December 04, 2004:
3D Scientifics
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 5th Dec 2004 12:12
Help! why isn't my sourcecode showing with my last post???


It says: "Error obtaining Source Code, invalid ID. Sorry but I've given up."
3D Scientifics
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 5th Dec 2004 13:21
Whatever happened who knows. I'm pasting my code here, sorry:

` 3D Earth View by 3DScientifics.com (Christopher Hill)
` Last rev December 05, 2004
` MOUSE rotates, MB1 zooms in, MB2 zooms out, ESC quits

global ObjectNum
camDist = 200

color backdrop 0



make object sphere 1,200,100,100
load image "earth.jpg",2,1
texture object 1,2


do

if mouseclick() = 1 then camDist = camDist + 1
if mouseclick() = 2 then camDist = camDist - 1

ControlCamera(camDist+MouseZ())
sync
loop

function ControlCamera(dis)
SW = screen width()
SH = screen height()
ax = (MouseX()-(SW/2))/2
ay = (MouseY()-(SH/2))/2
position camera (sin(ax)*cos(ay))*dis, sin(ay)*dis, (cos(ax)*cos(ay))*dis
point camera 0, 0, 0
endfunction
3D Scientifics
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 9th Dec 2004 07:09
I found a way to add panning:

if upkey()=1 then move object up 1,0.5
if downkey()=1 then move object down 1,0.5
if leftkey()=1 then move object left 1,0.5
if rightkey()=1 then move object right 1,0.5

The problem is it is a 3D pan - is there a way to pan normal to the plane of the screen? If I have my shape rotated 90 degrees and "pan" it becomes a zoom. I want to pan parallel to the screen.

Thanks,
Chris
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 10th Dec 2004 09:08
How about moving the camera instead of the object? What size is that image? I don't want to download a 24MB image.

3D Scientifics
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 11th Dec 2004 08:29
It is 24 MB, try this one, it's the Moon, it's alot smaller: http://www.3dscientifics.com/3d_moon.html

I guess I need to use Position Camera X,Y,Z?

Login to post a reply

Server time is: 2024-09-23 06:24:50
Your offset time is: 2024-09-23 06:24:50