Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.62 KB

addObject.markdown

File metadata and controls

41 lines (28 loc) · 1.62 KB

shader.addObject()

 
Type function
Library shader.*
See also removeObject()
Visual Guide Visual Guide

Overview

Adds an object to the Dynamic Shader. The object can be a display object or physics body.

A table named "shader" must be attached to the object before it is added to the Dynamic Shader. This table contains references to the image and normal map file for the object.

Syntax

shader.addObject( object )
object (required)

a display object or physics body.

Examples

local shader = require 'plugin.dynamic-shader'

-----add shaderInfo table to object------
object.shaderInfo = {  		    -- create the object.shaderInfo table
	name = "object", 	    	-- optional parameter - gives the object a name or the shader will assign one
	map1 = "art/object.png",    -- reference the image file
	map2 = "art/object_n.png"   -- refernece the normal map file
}
-----------------------------------
shader.addObject( object )  -- add object to the Dynamic Shader

shader.start()  -- turn on the Dynamic Shader