DescriptionA 3D engine programmed with easy use in mind.
Also includes 4D and MODE7.Instructions'---------
'3D ENGINE
'---------
'TO USE IN YOUR OWN PROGRAM, COPY UP TO THE
'"END 3D ENGINE" COMMENT INTO THE BEGINNING
'OF YOUR CODE.
'OR YOU CAN USE IT LIKE A LIBRARY BY
'CHANGING THE LINE
' GOTO @START
'TO
' END
'AND PUTTING
' SYSBEEP=0
' LOAD"PRG1:3DENGINE",FALSE
' USE 1:EXEC 1
' SYSBEEP=1
'INTO THE BEGINNING OF YOUR CODE.
'THINGS IN THIS ENGINE:
'MODULUS(VALUE1,VALUE2)
'SUBSTITUTE MODULUS FUNCTION
'IT IS THE SAME AS "VALUE1 MOD VALUE2", EXCEPT
'IT CAN RETURN DECIMAL NUMBERS, NOT JUST INTEGERS
'CAMERA CX,CY,CZ,ANGX,ANGY,ANGZ
'CHANGES CAMERA LOCATION AND ANGLE
'CX,CY, AND CZ ARE THE CAMERA'S COORDINATES
'ANGX,ANGY, AND ANGZ ARE THE CAMERA'S ANGLES
'PARALLAX ZOOM,EYEDIST,FOCUS,LEVEL3D
'ZOOM IS THE ZOOM LEVEL(HIGHER NUMBERS=LESS PERSPECTIVE DISTORTION)
'EYEDIST IS THE DISTANCE BETWEEN THE CAMERA'S "EYES."
'FOCUS IS THE Z COORDINATE OF THE FOCAL POINT.
'THE FOCAL POINT APPEARS AT THE SAME DEPTH
'AS THE SCREEN.
' 0 MAKES THE HORIZON THE FOCAL POINT.
'LEVEL3D IS LIKE A 3D SLIDER. IT RANGES FROM 0-1.
'IF LEVEL3D IS 0 THEN THE PARALLAX BARRIER WILL TURN OFF
'AND FRAMERATE MAY INCREASE.
'LIGHT LX,LY,LZ,INTENSITY,MINIMUM,MIDDLE
'CONTROLS THE LIGHTING
'LX, LY, AND LZ ARE THE COORDINATES OF THE
'LIGHT SOURCE
'INTENSITY, MINIMUM, AND MIDDLE ADJUST THE
'LIGHTING EFFECT
'-INTENSITY MAKES THE LIGHT MORE OR LESS
' HARSH
'-MINIMUM SETS A MINIMUM BRIGHTNESS A TRIANGLE
' CAN HAVE
'-MIDDLE GOES FROM 0 TO INTENSITY*2 AND
' SPECIFIES THE "MIDDLE" BRIGHTNESS
'-SOME INTENSITY,MINIMUM,MIDDLE SETS:
' REGULAR SHADING: 1,0.2,1
' CEL SHADING: 10,0.5,7
' SOFTER LIGHT: 0.5,0.2,1
' SOFT BRIGHT LIGHT: 0.5,0.2,1.5
' NO LIGHTING EFFECTS: 0,0,2
'PROJMODE MODE
'SETS THE PROJECTION METHOD
'0 IS PERSPECTIVE AND 1 IS ORTHOGRAPHIC
'PERSPECTIVE IS THE DEFAULT
'CULL VALUE
'SETS BACKCULLING TO ON OR OFF
'CULLING ONLY DRAWS POLYGONS FACING TOWARDS
'THE CAMERA. IT CAN INCREASE SPEED, BUT IF YOU
'DON'T WANT TO CARE ABOUT ORDERING YOUR
'VERTICES OR WANT YOUR TRIANGLES TO BE
'VISIBLE FROM BOTH SIDES, TURN IT OFF.
'ALSO, IT'S BROKEN IN ORTHOGRAPHIC MODE.
'ON BY DEFAULT
'CURRBUFF()
'GETS THE GRAPHIC PAGE BEING WRITTEN TO
'EITHER 2 OR 3
'ADDTRI X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,OBJ,R,G,B
'ADDS A TRIANGLE TO THE SCENE
'THE FIRST 9 PARAMETERS ARE THE COORDINATES FOR THE THREE POINTS OF THE TRIANGLE
'OBJ IS THE NUMBER ID OF THE OBJECT TO ADD THIS TRIANGLE TO
'-OBJECTS ARE LINKED TRIANGLES. YOU CAN OFFSET AND ANGLE AN ENTIRE OBJECT,
'-AND ALL THE TRIANGLES THAT MAKE UP THE OBJECT WILL BE OFFSETTED AND ANGLED.
'R, G, AND B ARE THE COLOR CODES FOR THE TRIANGLE
'ADDLINE X1,Y1,Z1,X2,Y2,Z2,OBJ,R,G,B
'ADDS A LINE TO THE SCENE
'THE FIRST 6 PARAMETERS ARE THE COORDINATES FOR THE TWO POINTS OF THE LINE
'OBJ IS THE NUMBER ID OF THE OBJECT TO ADD THIS TRIANGLE TO
'R, G, AND B ARE THE COLOR CODES FOR THE TRIANGLE
'ADDSPRITE X,Y,Z,U,V,W,H,SCALE,OBJ
'ADDS A SPRITE TO THE SCENE
'X,Y, AND Z ARE THE COORDINATES OF THE CENTER OF THE SPRITE
'U AND V ARE THE COORDINATES ON THE SPRITESHEET TO USE
'W AND H ARE THE DIMENSIONS ON THE SPRITESHEET
'SCALE IS THE SIZE OF THE SPRITE IN 3D SPACE
'OBJ IS THE OBJECT TO ADD THE SPRITE TO
'SPRITES ARE KIND OF LAGGY BECAUSE IT'S MANUALLY RENDERING EACH PIXEL.
'OBJOFS OBJ,X,Y,Z,ANGX,ANGY,ANGZ
'SETS AN OFFSET AND ANGLE FOR AN OBJECT
'OBJ IS THE OBJECT ID
'X, Y, AND Z ARE THE OFFSET COORDINATES
'ANGX, ANGY, AND ANGZ ARE THE ANGLES FOR THE OBJECT
'TO GET CURRENT OBJECT VARIABLES USE:
'OBJX(OBJ), OBJY(OBJ), OBJZ(OBJ), OBJANGX(OBJ), OBJANGY(OBJ), AND OBJANGZ(OBJ)
'CHECKOBJ(OBJ)
'CHECKS IF AN OBJECT EXISTS
'RETURNS 0 IF OBJECT DOESN'T EXIST
'RETURNS 1 IF OBJECT EXISTS
'DESTROYOBJ OBJ
'REMOVES AN OBJECT
'OBJ IS THE OBJECT NUMBER TO DESTROY
'OTHER OBJECT NUMBERS WILL NOT BE AFFECTED
'ROTMODE "AXIS","AXIS","AXIS"
'SETS ORDER OF ROTATION
'"AXIS" IS A STRING THAT CAN BE "X","Y", OR "Z"
'@RENDER3D
'RENDERS THE SCENE
'MEANT TO BE EXECUTED ONCE EVERY FRAME
'NOTE:
'-THIS ENGINE USES CARTESIAN COORDINATES, SO
' Y INCREASES UPWARDS INSTEAD OF DOWNWARDS
' LIKE IN SCREEN COORDINATES.
'-Z INCREAS AWAY FROM THE CAMERA.
'-ANGLES ARE IN DEGREES.
9 Comment(s)MazkaaMode 7 The classic mario kart SNES mode!JohnCorbyUnfortunately, I think there is a bug where it stops rendering a triangle when its center is off screen. This means that huge planes can easily stop rendering.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!HobbiesThis is amazing, my jaw dropped when I ran it
Oh my goodness I would love to use this to make a gameSimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!HobbiesSimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!HobbiesIdk why I hadn't found this submission earlier12Me21AdminSyntax HighlighterReceived for creating the code syntax highlighter on SBS4D?ThatStupidGuyAvatar TabooI didn't change my avatar for 180 daysWebsiteAvatar EmbargoI didn't change my avatar for 90 daysWebsiteAvatar BlockI didn't change my avatar for 30 days.WebsiteYes 4D.
In mathematics, four-dimensional space ("4D") is a geometric space with four dimensions. It typically is more specifically four-dimensional Euclidean space, generalizing the rules of three-dimensional Euclidean space. It has been studied by mathematicians and philosophers for over two centuries, both for its own interest and for the insights it offered into mathematics and related fields.
Algebraically, it is generated by applying the rules of vectors and coordinate geometry to a space with four dimensions. In particular a vector with four elements (a 4-tuple) can be used to represent a position in four-dimensional space. The space is a Euclidean space, so has a metric and norm, and so all directions are treated as the same: the additional dimension is indistinguishable from the other three.
In modern physics, space and time are unified in a four-dimensional Minkowski continuum called spacetime, whose metric treats the time dimension differently from the three spatial dimensions (see below for the definition of the Minkowski metric/pairing). Spacetime is not a Euclidean space.
MYCRAFTisbestGood PageHiddenAchievementsVideo GamesI like to play video games!HobbiesAvatar TabooI didn't change my avatar for 180 daysWebsite@ThatStupidGuy
You realize that one word question is a month old right?Mr_MoReadingI like to read books!HobbiesVideo GamesI like to play video games!HobbiesZelda Is Awesome!I love The Legend Of Zelda!Express Yourself@ThatStupidGuy
#wikipedia plagerism