Difference between revisions of "Mugic/protocol"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(Draw Commands)
(Draw Commands)
Line 76: Line 76:
  
 
By convention, CalVR uses a coordinate system in which x extends to the right, y goes forward, and z is up. If a different coordinate system should be used, the ScreenConfig values in CalVR have to be changed accordingly.
 
By convention, CalVR uses a coordinate system in which x extends to the right, y goes forward, and z is up. If a different coordinate system should be used, the ScreenConfig values in CalVR have to be changed accordingly.
 +
 +
All draw commands can use an optional <tt>name</tt> parameter to set a name for the geometry, which can later be referenced, for instance to update some of its parameters, such as position to move it. The name has to follow the rules for C++ variable names. Examples for valid names: test, Test, test3, test_5, test4me. Examples for invalid names: 4test, test 5, test[4]me.
  
 
In this specification, 3D positions will be abbreviated by POSITION and can be specified either separately as <pre>x=<xpos> y=<ypos> z=<zpos></pre>
 
In this specification, 3D positions will be abbreviated by POSITION and can be specified either separately as <pre>x=<xpos> y=<ypos> z=<zpos></pre>
Line 97: Line 99:
  
 
;Syntax
 
;Syntax
:point name=<name> POSITION r=<red> g=<green> b=<blue> a=<alpha>
+
:point name=<name> POSITION COLOR
:point name=<name> POSITION rgba=<red>,<green>,<blue>,<alpha>
+
:point name=<name> POSITION COLOR
  
 
;Parameters
 
;Parameters
Line 125: Line 127:
  
 
;Syntax
 
;Syntax
:quad name=<name> xyz1=<xpos1>,<ypos1>,<zpos1> xyz2=<xpos2>,<ypos2>,<zpos2>, xyz3=<xpos3>,<ypos3>,<zpos3> xyz4=<xpos4>,<ypos4>,<zpos4> rgb=<red>,<green>,<blue>
+
:quad name=<name> xyz1=<xpos1>,<ypos1>,<zpos1> xyz2=<xpos2>,<ypos2>,<zpos2>, xyz3=<xpos3>,<ypos3>,<zpos3> xyz4=<xpos4>,<ypos4>,<zpos4> COLOR
  
 
===Rectangle===
 
===Rectangle===
Line 132: Line 134:
  
 
;Syntax:  
 
;Syntax:  
:rectangle name=<name> POSITION width=<width> height=<height> r=<red> g=<green> b=<blue>
+
:rectangle name=<name> POSITION width=<width> height=<height> COLOR
  
 
;Parameters:
 
;Parameters:
Line 142: Line 144:
  
 
;Syntax:  
 
;Syntax:  
:circle name=<name> POSITION radius=<radius> rgba=<red>,<green>,<blue>,<alpha>
+
:circle name=<name> POSITION radius=<radius> COLOR
  
 
;Parameters:
 
;Parameters:
Line 158: Line 160:
  
 
;Syntax:  
 
;Syntax:  
:box name=<name> POSITION width=<width> height=<height> depth=<depth> r=<red> g=<green> b=<blue>
+
:box name=<name> POSITION width=<width> height=<height> depth=<depth> COLOR
  
 
;Parameters:
 
;Parameters:
Line 171: Line 173:
  
 
;Syntax:  
 
;Syntax:  
:sphere name=<name> POSITION radius=<radius> rgba=<red>,<green>,<blue>,<alpha>
+
:sphere name=<name> POSITION radius=<radius> COLOR
  
 
;Parameters:
 
;Parameters:
:xyz: location of center point of sphere [millimeters]
+
:radius: sphere radius in millimeters
:radius: circle radius [millimeters]
+
:rgba: sphere color components red, green, blue, alpha [0..1]
+
  
 
=== Cylinder ===
 
=== Cylinder ===

Revision as of 21:48, 14 November 2012

Contents

Overview

MUGIC defines a protocol for a standard display-independent client/server model for the generation, control, and management of graphics rendering within a multi-user environment. The first implementation for the CalVR system used on the state-of-the-art visualisation technologies developed at Calit2. This protocol will provide ease of access and an integrated development environment for research, education, performance, interaction, and presentations. It will provide an easily accessible format for integration of real-time programming softwares (e.g., Touch Designer, Pure Data, Max/MSP, Quartz, Processing, etc.) which in turn will facilitate the incorporation of state-of-the-art gesture control and algorithmic/generative processes for control of graphics on multiple displays. The protocol will also provide multi-user management and access support, as well as real-time telematic connection between multiple servers materializing an enormous potential for development of multi-site virtual reality game and performance productions.


-Server listens to both tcp and udp -UDP and TCP streams will work in conjunction and in collaboration with each other -UDP commands have a 1400 byte limit (or whatever the lower limit is of the client and server MAClayer)


User management every tcp connection has a ttl after the ttl time, the scene associated with user will be deleted

Object managment every object has an owner object can be a collection of objects

Syntax

cmd name [parameter={value,`expr`} ...]

expr is a c-style expression

Parameters

cx cy cz

red green blue alpha r g b a

Gradient { circular,linear,exp}

red2 green2 blue2 alpha2

(for linear gradient). gx gy gz (defined as a vector)

rotx roty rotz

scale

scalex scaley scalez

Variables

var name type={float,array} {value,`expr`}

variables can be used in expressions

variables of other users can also be accessed as user:variable

parameters of objects can be accessed as variables ObjectName:parameter

the value of a parameter of an object of another user is accessed as

User:ObjectName:parameter

Connections

connect <username>

[shouldn't this rather be something like 'user' to set the user name? This would allow: changing the user name, and using the API without a user name if the command is never called -- jurgen]

User Management and Preferences

pref [cmd] [parameter=value]

default object [parameter=[value,`expr`]

Draw Commands

All geometry lives in a 3D space. To keep the geometry in a plane to emulate 2D, set one of the three coordinates to zero.

By convention, CalVR uses a coordinate system in which x extends to the right, y goes forward, and z is up. If a different coordinate system should be used, the ScreenConfig values in CalVR have to be changed accordingly.

All draw commands can use an optional name parameter to set a name for the geometry, which can later be referenced, for instance to update some of its parameters, such as position to move it. The name has to follow the rules for C++ variable names. Examples for valid names: test, Test, test3, test_5, test4me. Examples for invalid names: 4test, test 5, test[4]me.

In this specification, 3D positions will be abbreviated by POSITION and can be specified either separately as
x=<xpos> y=<ypos> z=<zpos>
or more compact as
xyz=<xpos>,<ypos>,<zpos>

In either case, the parameters <xpos>, <ypos> and <zpos> are the coordinates in millimeters. The compact form is derived from the GLSL shader language.

Colors will be abbreviated by COLOR and can be specified either separately as
r=<red> g=<green> b=<blue>
or more compact as
rgb=<red>,<green>,<blue>

In either case, the parameters <red>, <green> and <blue> are the coordinates as floating point numbers in the range of 0 to 1. 0 means lowest intensity, 1 means highest intensity.

If an alpha value is to be specified it can be done in one of these forms:

r=<red> g=<green> b=<blue> a=<alpha>
rgba=<red>,<green>,<blue>,<alpha>

In either case, <alpha> specifies the alpha value as a floating point value ranging from 0 for invisible to 1 for opaque.

Point

Draws a point (single pixel).

Syntax
point name=<name> POSITION COLOR
point name=<name> POSITION COLOR
Parameters
x, y, z: point coordinates in millimeters
r, g, b: color values for red, green, blue; floating point values in range 0 to 1
a: alpha (opacity) value [0..1]
xyz: GLSL-style compact form to set all three coordinates at once
rgba: GLSL-style compact form to set all three color components at once

Triangle

Defines vertex coordinates and per-vertex colors for a triangle.

Syntax
triangle name=<name> xyz1=<xpos1>,<ypos1>,<zpos1> xyz2=<xpos2>,<ypos2>,<zpos2>, xyz3=<xpos3>,<ypos3>,<zpos3> rgb=<red>,<green>,<blue>
triangle name=<name> xyz1=<xpos1>,<ypos1>,<zpos1> xyz2=<xpos2>,<ypos2>,<zpos2>, xyz3=<xpos3>,<ypos3>,<zpos3> rgb1=<red1>,<green1>,<blue1> rgb2=<red2>,<green2>,<blue2> rgb3=<red3>,<green3>,<blue3>
Parameters
xyz1,xyz2,xyz3: GLSL-style compact form to set all three coordinates for each vertex
rgb: GLSL-style compact form to set all three color components to be applied to all three vertices (produces single-colored triangle)
rgb1,rgb2,rgb3: GLSL-style compact form to set all three color components for each vertex

Quad

Draws a quadrangle by creating an OpenGL GL_QUAD object. Note that if all four vertices are not in one plane, intersections of the quad with other geometry might produce unexpected results.

Syntax
quad name=<name> xyz1=<xpos1>,<ypos1>,<zpos1> xyz2=<xpos2>,<ypos2>,<zpos2>, xyz3=<xpos3>,<ypos3>,<zpos3> xyz4=<xpos4>,<ypos4>,<zpos4> COLOR

Rectangle

Draws an axis parallel 2D rectangle. Its origin is in its geometrical center.

Syntax
rectangle name=<name> POSITION width=<width> height=<height> COLOR
Parameters
width: extends along x axis [millimeters]
height: extends along y axis [millimeters]
r,g,b: fill color components red, green, blue [0..1]

Circle

Syntax
circle name=<name> POSITION radius=<radius> COLOR
Parameters
xyz: location of center point of circle [millimeters]
radius: circle radius [millimeters]
rgb: fill color components red, green, blue [0..1]

Ellipse

c2x c2y c2z

Box

Draws an axis-parallel rectangular box. Its origin is in its geometrical center.

Syntax
box name=<name> POSITION width=<width> height=<height> depth=<depth> COLOR
Parameters
width: extends along x axis [millimeters]
height: extends along y axis [millimeters]
depth: extends along z axis [millimeters]
r,g,b: box color components red, green, blue [0..1]

Sphere

Draws a 3D sphere. The xyz coordinates are for its center point.

Syntax
sphere name=<name> POSITION radius=<radius> COLOR
Parameters
radius: sphere radius in millimeters

Cylinder

Pyramid

Update

group

group name [names ... ]

Examples

Example 1

connect user1

circle name=cir1 cx=1000 cy=2000 radius=3000

sphere name=xph1 cx=1000 cy=2000 cz=3000 radius=1000

Example 2

connect user1

var var1=2

circle name=x1 cx=`-var1` radius=`10000/var1`

update var1=3000

update var1=5000

update var1=10000

update x1 cx=`var*1.5`

Example 3

connect user1

var var1=2000; var var2=2500

circle name=c1 cx=`-var1` cy=0 radius=`10000/var1`

square name=s1 cx=`var1` cy=0 width=`abs((2*var-10000/var1)/2)`

group x1 c1 s1

update x1 cx=5000

update x1 cx=7000

Next Phase

alias (e.g. alias square quad ....... )

move dur=

delete dur=

scale

rotate

sheer

copy name= src= link name= src= transformation=

Camera Management

Lighting Management


Quad ID=X p1=0,0 p2=1,0 p3=1,1 P4=0,0 link ID=A src=X scale id=A factor=0.2 move ID= dx=.1 dy=.5 group iD=C A,B