#VRML V2.0 utf8
# Cloud plot point prototype 
# A lightweight data plotting template for plotting 3d objects with the 
#  color and intensity of a plotted cube as the 4th dimension. 
#  This point plots as a cube of a translucent color. 
#   Many scatter points of this object create a cloud 

#  A component in a 3D data plotting application 
# Kurt A. Fisher fisherka@csolutions.net  beginner level VRML coder
# 12/2003

#  Light-weight version extracted from SO_proto.wrl 
#  This light-weight verison only reports its metadata through the brower status line on a MouseOver event 
#  This object cannot report its metadata by a billboarding text label. 
#  Translucency is also configurable. 

# ====================================
# Usage 

# CL { 
#	objName		[ "Object", "Alternate Name" ]	# object
#	objClass	"Type"			# type of object for EIA sort select
#	subClass	"SubType"		# subtype of object for EIA sort select
#	objPosition	0.0 0.0 0.0		# position
#	objSize		0.01 0.01 0.01		# size - radii in x,y,z planes - not diameters 
#	objColor	0.0 0.0 0.0		# object color
#	objTransparency	0.8			# object transparency 
#}

# ====================================
# Prototype for plotting lightweight cloud point objects 
PROTO CL [ 
	exposedField MFString	objName		[ "Object", "Alternate Name" ]	# object
	exposedField SFString	objClass	"Type"			# type of object for EIA sort select
	exposedField SFString	subClass	"SubType"		# subtype of object for EIA sort select
	exposedField SFVec3f	objPosition	0.0 0.0 0.0			# position
	exposedField SFVec3f 	objSize		0.01 0.01 0.01		# size - radii in x,y,z planes - not diameters 
	exposedField SFColor	objColor	0.0 0.0 0.0			# obj color
	exposedField SFFloat	objTransparency 0.8			# object translucency  
] {

#  Start plot point  
DEF Sphere_Object Transform {
#                           Key position of object, translated in x,y,z
		translation IS objPosition
		children [

#  Start shape of Sphere_Object
#       Start sphere of a SO 

#  To keep objSize type uniform as 3f vector,  use Transform to resize the spherical object 
		Transform {
#                                         Key size of object, stretched in x,y,z
			scale IS objSize
			children [

#  PLOT SHAPE WITH CUBE OBJECT
	# version 4: shape cube 
		Group { 
			children [ 
						Shape {				
							appearance Appearance {
								material Material { 
#									diffuseColor IS objColor
									emissiveColor IS objColor
									shininess .08
									transparency IS objTransparency # 0.8
								}
							}
							geometry Box {  } # end geometry
						} # end shape
						] # end children
					} # end anchor 
			] # children
		} # end Group

# ADD SENOR (TOUCH) FOR OBJECT 
		DEF sense_Sphere_Object TouchSensor {  }
# END SENOR (TOUCH) FOR OBJECT 

		]  # end children of Transform of Sphere_Object 
	}  # end of Transform of Sphere_Object 
#  END PLOTTED OBJECT


# BEGIN PASS DATA FROM EXPOSED FIELDS IN PROTOTYPE TO OBJECT INSTANCE 
DEF tmp_lblName Text { string IS objName }						# to set label types on initialization
# END PASS DATA FROM PROTOTYPE TO OBJECT INSTANCE 

# Popup label in browser status bar 
DEF display_Message Script { 
	field SFNode LabelNode USE tmp_lblName
	eventIn SFBool set_boolean
	url [
		"javascript:
		function set_boolean (bolValue) { 

	//  Syntax - for Cosmo compability
//  Convert string array to string 
browser_desc_changed = new String();
array_desc_changed = new Array();

array_desc_changed = LabelNode.string;
browser_desc_changed = array_desc_changed.toString(); 

//           Set popup label
if( bolValue == true ) { Browser.setDescription(browser_desc_changed); }
	//  Syntax - for Blaxxun compatibility - remove if ... else statement 
if( bolValue == false ) { Browser.setDescription(''); }

	}" 
	] # end url 
#            Output events for browser router are implied 
}  # end Script
# Router for popup label in browser 
ROUTE sense_Sphere_Object.isOver TO display_Message.set_boolean 
# End routers 

#  END BEHAVIORS OF OBJECT

}  # END OF SPHERICAL PROTOTYPE 


