News Overview SceneEngine Downloads VideoTutorials Main Page SourceForge Get Involved Bookmark and Share

SphereObjects are created in SceneEngine Lua calling the sceng.SphereObject factory.

SphereObject

Contents

Attributes :

  • radius : The radius of the SphereObject.
  • subdivs_height : The number of subdivisions in the height.
  • subdivs_axis : The number of subdivisions in the axis, slices.

LuaScript

SphereObjects are created by calling the SphereObject Lua factory:

sphere_object = sceng.SphereObject( { radius=20.0, subdivs_axis=32, subdivs_height=32, material=ref_uv_material } )

This factory accets a table with named attributes and returns a node with the SphereObject as a dependency.

Sample script

The following script creates a SphereObject with a material applied:

-- Open SceneEngine libraries
require("sceng_lua")
 
-- Create the Bitmap Texture
ref_uv_texture = sceng.BitmapTexture( { file_path="maps/ref_uv.png" } )
 
-- Create the ShaderMaterial
ref_uv_material = sceng.ShaderMaterial( { diffuse_color=sceng.Color(1,1,0), diffuse_texture=ref_uv_texture } )
 
-- Create the BoxObject
sphere_object = sceng.SphereObject( { radius=20.0, subdivs_axis=32, subdivs_height=32, material=ref_uv_material } )
 
rp = sceng.RenderParameters()
 
rp.output_file = "output/image.png"
 
rp.width = 512
rp.height = 512
rp.samples = 2
 
-- Render the scene
sceng.Render( rp )

This is the rendered image:

Image:LuaBlock_SphereObject.jpg

Note : This script doesn't create lights nor cameras, these are created by default by the renderer, so your rendered result might vary slightly from the image shown above.

Views