At conjured Entertainment
a bit off topic but I created the following 3d plants procedurally
//https://forum.thegamecreators.com/thread/80144
SetWindowTitle( "Fractal Math" )
SetWindowSize( 1024, 768, 0 )
SetSyncRate(30,0) `
// set display properties
SetVirtualResolution( 1024, 768 )
SetClearColor(0,0,0)
SetCameraPosition(1,0,0,-150)
SetCameraLookAt(1,0,0,0,0)
CreateShrub(1,100,100) //there are 4 objects that make up a shrub therefore the second must start at 5
CreateShrub(5,100,100)
SetObjectPosition(1,-40,0,0)
SetObjectPosition(5,40,0,0)
repeat
RotateObjectGlobalY(1,.2) //rotate the two shrubs differently so you can check them out
RotateObjectGlobalX(5,.2)
Sync()
until GetRawKeyPressed(32) //spacebar
end
function createShrub(objectNum as integer, xSize as float,ySize as float)
ClearScreen()
Render()
fern(256,668,7,90,7,50,150)
fern(255,668,7,90,7,50,150)
fern(257,668,7,90,7,50,150)
fern(254,668,7,90,7,50,150)
fern(258,668,7,90,7,50,150)
DrawLine(256,668,256,768,MakeColor(55,255,55),MakeColor(55,255,55))
DrawBox (254,668,258,768,MakeColor(55,255,55),MakeColor(55,255,55),MakeColor(55,255,55),MakeColor(55,255,55),1)
Swap()
img = getimage(0,320,512,768)
CreateObjectPlane(objectNum,xSize,ySize)
InstanceObject(objectNum+1,objectNum)
InstanceObject(objectNum+2,objectNum)
InstanceObject(objectNum+3,objectNum)
SetObjectPosition(objectNum,0,0,0)
SetObjectPosition(objectNum+1,0,0,0)
SetObjectPosition(objectNum+2,0,0,0)
SetObjectPosition(objectNum+3,0,0,0)
SetObjectRotation(objectNum,0,0,0)
SetObjectRotation(objectNum+1,0,45,0)
SetObjectRotation(objectNum+2,0,90,0)
SetObjectRotation(objectNum+3,0,135,0)
SetObjectImage(objectNum,img,0)
SetObjectImage(objectNum+1,img,0)
SetObjectImage(objectNum+2,img,0)
SetObjectImage(objectNum+3,img,0)
SetObjectTransparency(objectNum,1)
SetObjectTransparency(objectNum+1,1)
SetObjectTransparency(objectNum+2,1)
SetObjectTransparency(objectNum+3,1)
FixObjectToObject(objectNum+1,objectNum)
FixObjectToObject(objectNum+2,objectNum)
FixObjectToObject(objectNum+3,objectNum)
endfunction
REM ====== FERN FRACTAL =======
REM X,Y - starting position for fern, root of first stem
REM passes - number of iterations
REM startAngle - angle to start drawing on this pass
REM bendAngle - overall bending angle of the whole leaf
REM branchAngle - angle to branch off each stem at
REM height - starting height
function fern(x as float, y as float, passes as integer, startAngle as float, bendAngle as float, branchAngle as float, height as float)
rootAngle# = wrapvalue(startAngle - bendAngle)
x2 = x + cos(rootAngle#)*height
y2 = y - sin(rootAngle#)*height
DrawLine(x,y,x2,y2,MakeColor(55,255,55),MakeColor(55,255,55))
height = height*0.5
x3 = x + cos(wrapvalue(rootAngle#+branchAngle))*height
y3 = y - sin(wrapvalue(rootAngle#+branchAngle))*height
DrawLine(x,y,x3,y3,MakeColor(55,255,55),MakeColor(55,255,55))
x4 = x + cos(wrapvalue(rootAngle#-branchAngle))*height
y4 = y - sin(wrapvalue(rootAngle#-branchAngle))*height
DrawLine(x,y,x4,y4,MakeColor(55,255,55),MakeColor(55,255,55))
if passes > 1
fern(x2,y2,passes-1, rootAngle#, bendAngle, branchAngle, height)
fern(x3,y3,passes-1, wrapvalue(rootAngle#+branchAngle), bendAngle, branchAngle, height)
fern(x4,y4,passes-1, wrapvalue(rootAngle#-branchAngle), bendAngle, branchAngle, height)
endif
endfunction
function wrapvalue(num as float)
while num>360
num=num-360
endwhile
endfunction num
Theres plants and trees here
https://forum.thegamecreators.com/thread/222027
also further down the post you will see a 3d game called "A small random 3D world of fractals and Kaleidoscopes"
which uses both the trees and plants that I entered in one of the TGC code challenges