Esempio n. 1
0
class Appearance(node.Node):
    PROTO = 'Appearance'
    #Fields
    material = field.newField('material', 'SFNode', 1, node.NULL)
    texture = field.newField('texture', 'SFNode', 1, node.NULL)
    textureTransform = field.newField('textureTransform', 'SFNode', 1,
                                      node.NULL)
Esempio n. 2
0
class Text(nodetypes.Geometry, node.Node):
    PROTO = 'Text'
    #Fields
    length = field.newField('length', 'MFFloat', 1, list)
    fontStyle = field.newField('fontStyle', 'SFNode', 1, node.NULL)
    string = field.newField('string', 'MFString', 1, list)
    maxExtent = field.newField('maxExtent', 'SFFloat', 1, 0.0)
Esempio n. 3
0
class Cone(nodetypes.Geometry, node.Node):
    PROTO = 'Cone'
    #Fields
    bottom = field.newField('bottom', 'SFBool', 0, 1)
    side = field.newField('side', 'SFBool', 0, 1)
    bottomRadius = field.newField('bottomRadius', 'SFFloat', 0, 1.0)
    height = field.newField('height', 'SFFloat', 0, 2.0)
Esempio n. 4
0
 def ScriptFieldDecl( self, table, buffer):
     """Field declaration for a script node"""
     (tag, left, right, (exposure, datatype, name, value)) = table
     datatype = getString( datatype, buffer )
     self.fieldTypeStack.append(
         datatype
     )
     try:
         if value[0] == 'IS':
             mapName = self.IS( value, buffer )
             value = None
             fieldObject = field.newField(
                 getString(name, buffer),
                 datatype,
                 getString( exposure, buffer ) == 'exposedField',
             )
         else:
             mapName = None
             value = dispatch( self, value, buffer )
             fieldObject = field.newField(
                 getString(name, buffer),
                 datatype,
                 getString( exposure, buffer ) == 'exposedField',
                 value
             )
         return (fieldObject, mapName)
     finally:
         self.fieldTypeStack.pop()
Esempio n. 5
0
class TextureTransform(node.Node):
    PROTO = 'TextureTransform'
    #Fields
    rotation = field.newField('rotation', 'SFFloat', 1, 0.0)
    scale = field.newField('scale', 'SFVec2f', 1, [1.0, 1.0])
    translation = field.newField('translation', 'SFVec2f', 1, [0.0, 0.0])
    center = field.newField('center', 'SFVec2f', 1, [0.0, 0.0])
Esempio n. 6
0
class IntUniform(node.Node):
    """Uniform (variable) binding for a shader (integer form)
    """
    PROTO = "IntUniform"
    name = field.newField('name', 'SFString', 1, '')
    # type values, 1i,2i,3i,4i
    value = field.newField('value', 'MFInt32', 1, list)
Esempio n. 7
0
class VisualScene(scenegraph.SceneGraph):
    """A Visual-style scenegraph"""
    # background represents a SimpleBackground-style node...
    background = field.newField('background', 'SFColor', 1, (0, 0, 1))
    # ambient lighting
    ambient = field.newField("ambient", "SFFloat", 1, 0.2)
    # will have to be manually extracted from scenegraph
    lights = field.newField("lights", "MFVec3f", 1, [
        (2, 3, 2),
    ])
    # will have to be manually extracted from scenegraph
    objects = field.newField("objects", "MFNode", 1, list)

    def renderedChildren(self,
                         types=(
                             nodetypes.Children,
                             nodetypes.Rendering,
                         )):
        """List of all children that are instances of given types

        Default scenegraph uses "children" while the VPython
        scenegraph uses "objects"...
        """

        items = [child for child in self.objects if isinstance(child, types)]
        return items
Esempio n. 8
0
class NurbsGroup(node.Node):
    """(Unused) holder for multiple nurbs objects"""
    PROTO = "NurbsGroup"
    children = field.newField('children', 'MFNode', 1, list)
    tessellationScale = field.newField('tessellationScale', 'SFFloat', 1, 1.0)
    bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0])
    bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0])
Esempio n. 9
0
class SimpleBackground(nodetypes.Background, nodetypes.Children, node.Node):
    """Solid-color Background node

    This Background node provides the simplest rendering
    algorithm, merely clearing the color buffer to the node's
    "color" value.

    It also clears the depth buffer.

    Attributes of note within the Box object:

        color -- r,g,b giving the clear color
        bound -- whether or not this Background is active

    See:
        glClearColor, glClear
    """
    color = field.newField('color', 'SFColor', 1, [0.0, 0.0, 0.0])
    bound = field.newField('bound', 'SFBool', 1, 0)

    def Render(self, mode=None, clear=True):
        # should only do this on visible passes...
        if mode.passCount == 0:
            if self.bound and clear:
                r, g, b = self.color
                glClearColor(r, g, b, 1.0)
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
Esempio n. 10
0
class GLSLShader(node.Node):
    """GLSL-based shader node"""
    PROTO = "GLSLShader"
    url = field.newField('url', 'MFString', 1, list)
    source = field.newField('source', 'MFString', 1, list)
    imports = field.newField('imports', 'MFNode', 1, list)
    # type values, VERTEX or FRAGMENT
    type = field.newField('type', 'SFString', 1, 'VERTEX')
Esempio n. 11
0
class DirectionalLight(nodetypes.Children, nodetypes.Light, node.Node):
    PROTO = 'DirectionalLight'
    #Fields
    color = field.newField('color', 'SFColor', 1, [1.0, 1.0, 1.0])
    on = field.newField('on', 'SFBool', 1, 1)
    intensity = field.newField('intensity', 'SFFloat', 1, 1.0)
    ambientIntensity = field.newField('ambientIntensity', 'SFFloat', 1, 0.0)
    direction = field.newField('direction', 'SFVec3f', 1, [0.0, 0.0, -1.0])
Esempio n. 12
0
class Cylinder(nodetypes.Geometry, node.Node):
    PROTO = 'Cylinder'
    #Fields
    top = field.newField('top', 'SFBool', 0, 1)
    bottom = field.newField('bottom', 'SFBool', 0, 1)
    radius = field.newField('radius', 'SFFloat', 0, 1.0)
    side = field.newField('side', 'SFBool', 0, 1)
    height = field.newField('height', 'SFFloat', 0, 2.0)
Esempio n. 13
0
class ColorInterpolator(nodetypes.Children, nodetypes.Interpolator, node.Node):
    PROTO = 'ColorInterpolator'
    #Fields
    keyValue = field.newField('keyValue', 'MFColor', 1, list)
    key = field.newField('key', 'MFFloat', 1, list)
    #Events
    set_fraction = field.newEvent('set_fraction', 'SFFloat', 0)
    value_changed = field.newEvent('value_changed', 'SFColor', 1)
Esempio n. 14
0
class Glyph3D(Glyph):
    """Storage for a 3D glyph's data"""
    PROTO = "Glyph3D"
    character = field.newField('character', 'SFString', 1, "")
    width = field.newField('width', 'SFFloat', 1, 0.0)
    height = field.newField('height', 'SFFloat', 1, 0.0)
    contours = field.newField('contours', 'MFVec2f', 1, list)
    outlines = field.newField('outlines', 'MFVec2f', 1, list)
Esempio n. 15
0
class FontStyle3D(FontStyle):
    """FontStyle with ability to specify 3D extrusion properties"""
    PROTO = 'FontStyle3D'
    quality = field.newField('quality', 'SFInt32', 1, 3)
    renderFront = field.newField('renderFront', 'SFBool', 1, 1)
    renderSides = field.newField('renderSides', 'SFBool', 1, 0)
    renderBack = field.newField('renderBack', 'SFBool', 1, 0)
    thickness = field.newField('thickness', 'SFFloat', 1, 0.0)
Esempio n. 16
0
class NurbsCurve2D(node.Node):
    """A 2D nurbs curve normally used for trimming surfaces"""
    PROTO = "NurbsCurve2D"
    knot = field.newField('knot', 'MFFloat32', 1, list)
    order = field.newField('order', 'SFInt32', 1, 3)
    controlPoint = field.newField('controlPoint', 'MFVec2f', 1, list)
    weight = field.newField('weight', 'MFFloat32', 1, list)
    tessellation = field.newField('tessellation', 'SFInt32', 1, 0)
Esempio n. 17
0
class Shader(node.Node):
    """Shader is a programmable substitute for an Appearance node"""
    PROTO = 'Shader'
    #Fields
    material = field.newField('material', 'SFNode', 1, node.NULL)
    objects = field.newField('objects', 'MFNode', 1, list)

    implementation = field.newField('implementation', 'SFNode', 1, node.NULL)
Esempio n. 18
0
class Fog(nodetypes.Fog, nodetypes.Children, node.Node):
    PROTO = 'Fog'
    #Fields
    color = field.newField('color', 'SFColor', 1, [1.0, 1.0, 1.0])
    visibilityRange = field.newField('visibilityRange', 'SFFloat', 1, 0.0)
    fogType = field.newField('fogType', 'SFString', 1, 'LINEAR')
    #Events
    set_bind = field.newEvent('set_bind', 'SFBool', 0)
    isBound = field.newEvent('isBound', 'SFBool', 1)
Esempio n. 19
0
class GLSLObject(node.Node):
    """GLSL-based shader object (compiled set of shaders)"""
    PROTO = "GLSLObject"
    # role values, VISIBLE, DEPTH, SELECT
    role = field.newField('role', 'SFString', 1, 'VISIBLE')
    uniforms = field.newField('uniforms', 'MFNode', 1, list)
    shaders = field.newField('shaders', 'MFNode', 1, list)
    # textures is a set of texture uniforms...
    textures = field.newField('textures', 'MFNode', 1, list)
Esempio n. 20
0
class Group(nodetypes.Children, nodetypes.Grouping, node.Node):
    PROTO = 'Group'
    #Fields
    bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0])
    children = field.newField('children', 'MFNode', 1, list)
    bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0])
    #Events
    removeChildren = field.newEvent('removeChildren', 'MFNode', 0)
    addChildren = field.newEvent('addChildren', 'MFNode', 0)
Esempio n. 21
0
class VisibilitySensor(nodetypes.Sensor, nodetypes.Children, node.Node):
    PROTO = 'VisibilitySensor'
    #Fields
    enabled = field.newField('enabled', 'SFBool', 1, 1)
    center = field.newField('center', 'SFVec3f', 1, [0.0, 0.0, 0.0])
    size = field.newField('size', 'SFVec3f', 1, [0.0, 0.0, 0.0])
    #Events
    exitTime = field.newEvent('exitTime', 'SFTime', 1)
    enterTime = field.newEvent('enterTime', 'SFTime', 1)
    isActive = field.newEvent('isActive', 'SFBool', 1)
Esempio n. 22
0
class SphereSensor(nodetypes.Children, nodetypes.PointingSensor, node.Node):
    PROTO = 'SphereSensor'
    #Fields
    enabled = field.newField('enabled', 'SFBool', 1, 1)
    autoOffset = field.newField('autoOffset', 'SFBool', 1, 1)
    offset = field.newField('offset', 'SFRotation', 1, [0.0, 1.0, 0.0, 0.0])
    #Events
    rotation_changed = field.newEvent('rotation_changed', 'SFRotation', 1)
    isActive = field.newEvent('isActive', 'SFBool', 1)
    trackPoint_changed = field.newEvent('trackPoint_changed', 'SFVec3f', 1)
Esempio n. 23
0
class Billboard(nodetypes.Children, nodetypes.Transforming, node.Node):
    PROTO = 'Billboard'
    #Fields
    bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0])
    axisOfRotation = field.newField('axisOfRotation', 'SFVec3f', 1,
                                    [0.0, 1.0, 0.0])
    children = field.newField('children', 'MFNode', 1, list)
    bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0])
    #Events
    removeChildren = field.newEvent('removeChildren', 'MFNode', 0)
    addChildren = field.newEvent('addChildren', 'MFNode', 0)
Esempio n. 24
0
class NurbsDomainDistanceSample(NurbsSampling):
    """Domain-distance parametric u and v coordinate sampling
    """
    uStep = field.newField("uStep", "SFFloat", 1, 100.0)
    vStep = field.newField("vStep", "SFFloat", 1, 100.0)

    def properties(self, nurbObject):
        """Configure this sampling type"""
        gluNurbsProperty(nurbObject, GLU_SAMPLING_METHOD, GLU_DOMAIN_DISTANCE)
        gluNurbsProperty(nurbObject, GLU_U_STEP, self.uStep)
        gluNurbsProperty(nurbObject, GLU_V_STEP, self.vStep)
Esempio n. 25
0
class FloatUniform(node.Node):
    """Uniform (variable) binding for a shader
    
    The FloatUniform is the base class for FloatUniforms,
    that is, there are FloatUniform1f, FloatUniform2f,
    FloatUniformm3x2, etceteras Node-types, but not a
    FloatUniform node-type.
    """
    name = field.newField('name', 'SFString', 1, '')
    # type values, 1f, 2f, 3f, 4f, m2, m3, m4, m2x3,m3x2,m2x4,m4x2,m3x4,m4x3
    value = field.newField('value', 'SFArray32', 1, list)
Esempio n. 26
0
class IndexedLineSet(nodetypes.Geometry, node.Node):
    PROTO = 'IndexedLineSet'
    #Fields
    color = field.newField('color', 'SFNode', 1, node.NULL)
    colorPerVertex = field.newField('colorPerVertex', 'SFBool', 0, 1)
    colorIndex = field.newField('colorIndex', 'MFInt32', 0, list)
    coord = field.newField('coord', 'SFNode', 1, node.NULL)
    coordIndex = field.newField('coordIndex', 'MFInt32', 0, list)
    #Events
    set_coordIndex = field.newEvent('set_coordIndex', 'MFInt32', 0)
    set_colorIndex = field.newEvent('set_colorIndex', 'MFInt32', 0)
Esempio n. 27
0
class Collision(nodetypes.Children, nodetypes.Grouping, node.Node):
    PROTO = 'Collision'
    #Fields
    bboxCenter = field.newField('bboxCenter', 'SFVec3f', 0, [0.0, 0.0, 0.0])
    collide = field.newField('collide', 'SFBool', 1, 1)
    proxy = field.newField('proxy', 'SFNode', 0, node.NULL)
    bboxSize = field.newField('bboxSize', 'SFVec3f', 0, [-1.0, -1.0, -1.0])
    children = field.newField('children', 'MFNode', 1, list)
    #Events
    removeChildren = field.newEvent('removeChildren', 'MFNode', 0)
    collideTime = field.newEvent('collideTime', 'SFTime', 1)
    addChildren = field.newEvent('addChildren', 'MFNode', 0)
Esempio n. 28
0
class PlaneSensor(nodetypes.Children, nodetypes.PointingSensor, node.Node):
    PROTO = 'PlaneSensor'
    #Fields
    maxPosition = field.newField('maxPosition', 'SFVec2f', 1, [-1.0, -1.0])
    enabled = field.newField('enabled', 'SFBool', 1, 1)
    autoOffset = field.newField('autoOffset', 'SFBool', 1, 1)
    minPosition = field.newField('minPosition', 'SFVec2f', 1, [0.0, 0.0])
    offset = field.newField('offset', 'SFVec3f', 1, [0.0, 0.0, 0.0])
    #Events
    translation_changed = field.newEvent('translation_changed', 'SFVec3f', 1)
    isActive = field.newEvent('isActive', 'SFBool', 1)
    trackPoint_changed = field.newEvent('trackPoint_changed', 'SFVec3f', 1)
Esempio n. 29
0
class NavigationInfo(nodetypes.Children, nodetypes.NavigationInfo, node.Node):
    PROTO = 'NavigationInfo'
    #Fields
    speed = field.newField('speed', 'SFFloat', 1, 1.0)
    avatarSize = field.newField('avatarSize', 'MFFloat', 1,
                                [0.25, 1.6000000000000001, 0.75])
    headlight = field.newField('headlight', 'SFBool', 1, 1)
    type = field.newField('type', 'MFString', 1, ['WALK'])
    visibilityLimit = field.newField('visibilityLimit', 'SFFloat', 1, 0.0)
    #Events
    set_bind = field.newEvent('set_bind', 'SFBool', 0)
    isBound = field.newEvent('isBound', 'SFBool', 1)
Esempio n. 30
0
class ProximitySensor(nodetypes.Sensor, nodetypes.Children, node.Node):
    PROTO = 'ProximitySensor'
    #Fields
    enabled = field.newField('enabled', 'SFBool', 1, 1)
    center = field.newField('center', 'SFVec3f', 1, [0.0, 0.0, 0.0])
    size = field.newField('size', 'SFVec3f', 1, [0.0, 0.0, 0.0])
    #Events
    position_changed = field.newEvent('position_changed', 'SFVec3f', 1)
    enterTime = field.newEvent('enterTime', 'SFTime', 1)
    exitTime = field.newEvent('exitTime', 'SFTime', 1)
    orientation_changed = field.newEvent('orientation_changed', 'SFRotation',
                                         1)
    isActive = field.newEvent('isActive', 'SFBool', 1)
Esempio n. 31
0
class Sound(nodetypes.Auditory, nodetypes.Children, node.Node):
    PROTO = 'Sound'
    #Fields
    priority = field.newField('priority', 'SFFloat', 1, 0.0)
    minFront = field.newField('minFront', 'SFFloat', 1, 1.0)
    intensity = field.newField('intensity', 'SFFloat', 1, 1.0)
    location = field.newField('location', 'SFVec3f', 1, [0.0, 0.0, 0.0])
    source = field.newField('source', 'SFNode', 1, node.NULL)
    maxBack = field.newField('maxBack', 'SFFloat', 1, 10.0)
    minBack = field.newField('minBack', 'SFFloat', 1, 1.0)
    maxFront = field.newField('maxFront', 'SFFloat', 1, 10.0)
    spatialize = field.newField('spatialize', 'SFBool', 0, 1)
    direction = field.newField('direction', 'SFVec3f', 1, [0.0, 0.0, 1.0])
Esempio n. 32
0
def proxyField( *arguments, **named ):
    """Create a new proxied field"""
    base = field.newField( *arguments, **named )
    return Proxy( base )
    
##class Forwarder( object ):
##	"""Mechanism for forwarding a set to a given sub-object"""
##	def __get__( self, client = None ):
##		if client is None:
##			return self
##		else:
##			return self.__class__( self.definition, client )
##	def __init__( self, definition, client=None ):
##		self.definition = definition
##		self.client = client
##	def __call__( self, *arguments, **named ):
##		if self.client is None and arguments:
##			client = arguments[0]
##			arguments = arguments[1:]
##		elif self.client is None:
##			raise TypeError( """Unbound forwarder not passed a client object as first argument""" )
##		else:
##			client = self.client
##		for attribute in self.definition:
##			
    
Esempio n. 33
0
 def extFieldDecl(self, table, buffer):
     ''' An external field declaration, no default value '''
     (tag, start, stop, (exposure, datatype, name)) = table
     datatype = getString( datatype, buffer )
     addField(
         self.prototypeStack[-1],
         field.newField(
             getString(name, buffer),
             datatype,
             getString( exposure, buffer ) == 'exposedField',
         )
     )
Esempio n. 34
0
 def fieldDecl( self, table, buffer):
     (tag, left, right, (exposure, datatype, name, value)) = table
     datatype = getString( datatype, buffer )
     self.fieldTypeStack.append(
         datatype
     )
     try:
         value = dispatch( self, value, buffer )
         addField(
             self.prototypeStack[-1],
             field.newField(
                 getString(name, buffer),
                 datatype,
                 getString( exposure, buffer ) == 'exposedField',
                 value,
             )
         )
     finally:
         self.fieldTypeStack.pop()