Skip to content

GLGE GFX messaging system.

supereggbert edited this page Sep 13, 2010 · 1 revision

The GLGE messaging system uses json as a basis and allows you update or create parts of the scene graph.

To send a message to be parsed simple call:
GLGE.Message.parseMessage({message to parse});

Messages consists of two types, “update” and “create”:

The “create” message contains:
uid – an optional user defined uid for the new object
type – the type of object to create “Material”,“Object”,“Group”, etc
attributes – an object containing the attributes to set as specified in the API, ie LocX LocY, RotZ, etc
children – an array of child objects to be added to the new object these can be either uids or alternativly a sub message to parse

The “update” message contains:
uid – the uid of the object to update
attributes – an object containing the attributes to set as specified in the API, ie LocX LocY, RotZ, etc
add – an array of child objects to be added to the object these can be either uids or alternativly a sub message to parse
remove – an array of uids to be removed from the object

Some examples:

create a new basic material with a texture:

{
	command:"create",
	type:"Material",
	attributes:{
		Specular:0.5,
		Color:"red"
	}
	add:[
		{
			command:"create",
			type:"Texture",
			uid:"texture1",
			attributes:{
				Src:"http://{some image}"
			}
		},
		{
			command:"create",
			type:"MaterialLayer",
			attributes:{
				Texture:"texture1",
				Mapinput:GLGE.UV1,
				Mapto:GLGE.M_COLOR
			}
		},
	]
}

more to come…

Clone this wiki locally