-
-
Notifications
You must be signed in to change notification settings - Fork 105
id M3D
pmgl edited this page May 6, 2022
·
1 revision
micro 3D is a simplified 3D API, created on top of Babylon.js. It is currently very minimal but it will grow in the future. If you are looking for a stable, feature-complete 3D API, look into Babylon.js instead.
After creating your project, open the settings tab, click "Show advanced settings" and choose micro 3D as "Graphics library".
Creating a new scene:
scene = new M3D.Scene()
scene.setBackground("rgb(9,0,28)")
Adding a simple box:
box = new M3D.Box()
box.position.set(0,0,5)
box.setColor("rgb(255,192,0)")
scene.add(box)
Adding a directional light:
light = new M3D.DirectionalLight(new M3D.Vector3(-1,-.5,1))
light.setColor("rgb(255,217,198)")
Setting up the camera:
camera = new M3D.Camera()
camera.position.set(0,0,1)
You can access objects properties in the update()
function to make them spin around in space
update = function()
box.rotation.x+=0.01
box.rotation.y+=0.02
end
In your function draw()
, simply call screen.render
, passing your scene and camera as arguments:
draw = function()
screen.render(scene,camera)
end