TGC Codebase Backup



Model Viewer by Doomwad

31st May 2004 0:50
Summary

This is my official model viewer. It's very fun and easy to use! You can type in your model name (i.e. Tank.3ds, john.x, etc.) or some of the primitives (cube, plain, sphere, cylin



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    remstart
Author: Tyler Walker
Program: Polyman Sutdios Internal Model Browser
This program is awesome, and very easy to use!
remend
main:
sync on
backtrue = 0
modeltrue = 1
rem load image "globe.bmp", 3
sync rate 500
input "please enter model file name(*.x, *.3ds): ", model$
input "please enter your texture. leave blank if you don't want one: ", texture$
input "please enter your backdrop texture: ", backdrop$
x = 100
if backdrop$="" then backtrue = 2
if backdrop$="red" then color backdrop rgb(255,0,0); backtrue=2
if backdrop$="blue" then color backdrop rgb(0,0,255); backtrue=2
if backdrop$="green" then color backdrop rgb(0,255,0); backtrue=2
if backdrop$="white" then color backdrop rgb(255,255,255); backtrue=2
if backdrop$="black" then color backdrop rgb(0,0,0); backtrue=2
if backtrue = 0 then load image backdrop$, 2; texture backdrop 2


if model$="plain" then make object plain 1, 100, 100 : modeltrue = 0
if model$="sphere" then make object sphere 1, 100 : modeltrue = 0
if model$="cube" then make object cube 1, 100 : modeltrue = 0
if model$="cylinder" then make object cylinder 1, 100 : modeltrue = 0
if model$="cone" then make object cone 1, 100 : modeltrue = 0
if model$="" then modeltrue = 0

if texture$ = ""
imagetrue = 0
goto bleh
else
load image texture$, 1
imagetrue = 1
endif
scale = 0
bleh:
hide mouse
rem load object
rem load object "H-Tank.x", 1
rem load object "what.3ds", 1
if modeltrue = 1 then load object model$, 1
if imagetrue = 1 then texture object 1, 1
rem ghost object on 1, 200

rem Main Loop
sync rate 50
repeat
set cursor 0, 0
print "Hit the arrow keys"

rem angle#=wrapvalue(angle#-2)
rem scale object 1, scale, scale, scale
remstart
if spacekey()=1 then scale = scale - 1
if shiftkey()=1 then scale = scale + 1
remend
if leftkey()=1 then angle#=wrapvalue(angle#-5)
if rightkey()=1 then angle#=wrapvalue(angle#+5)
if upkey()=1 then bangle#=wrapvalue(bangle#+5)
if downkey()=1 then bangle#=wrapvalue(bangle#-5)
y#=curvevalue(dy#, y#, 10.0)
x#=curvevalue(dx#, x#, 10.0)
scale object 1, x, x, x

if spacekey()=1 then x = x + 1
if shiftkey()=1 then x = x - 1

rem z#=curvevalue(dz#, z#, 10.0)

rem You can curve angles creating smooth transition of rotation
ca#=curveangle(angle#, ca#, 5.0)
cb#=curveangle(bangle#, cb#, 5.0)
rem Update the object with these new values

yrotate object 1,ca#
xrotate object 1,cb#
sync
until escapekey() = 1
end