Create a shade data object to be sent to the hub
160692
def _create_shade_data(self, position_data=None, room_id=None):
        """"""
        base = {ATTR_SHADE: {ATTR_ID: self.id}}
        if position_data:
            base[ATTR_SHADE][ATTR_POSITION_DATA] = position_data
        if room_id:
            base[ATTR_SHADE][ATTR_ROOM_ID] = room_id
        return base
713608
async def create_scene_member(self, shade_position, scene_id, shade_id):
        """"""

        data = {
            ATTR_SCENE_MEMBER: {
                ATTR_POSITION_DATA: shade_position,
                ATTR_SCENE_ID: scene_id,
                ATTR_SHADE_ID: shade_id,
            }
        }
        return await self.request.post(self._base_path, data=data)
1223361
function createRGBProxy(raw = false) {
    function get(me, key) {
        switch (key) {
            case "color": {
                if (typeof me.color === "string" && rgbRegex.test(me.color)) {
                    // predefined color, return it
                    return me.color;
                }
                else {
                    // calculate it from hue/saturation
                    const { r, g, b } = conversions_1.conversions.rgbFromHSV(me.hue, me.saturation / 100, 1);
                    return conversions_1.conversions.rgbToString(r, g, b);
                }
            }
            default: return me[key];
        }
    }
    function set(me, key, value) {
        switch (key) {
            case "color": {
                if (predefined_colors_1.predefinedColors.has(value)) {
                    // its a predefined color, use the predefined values
                    const definition = predefined_colors_1.predefinedColors.get(value); // we checked with `has`
                    if (raw) {
                        me.hue = definition.hue_raw;
                        me.saturation = definition.saturation_raw;
                    }
                    else {
                        me.hue = definition.hue;
                        me.saturation = definition.saturation;
                    }
                }
                else {
                    // only accept HEX colors
                    if (rgbRegex.test(value)) {
                        // calculate the X/Y values
                        const { r, g, b } = conversions_1.conversions.rgbFromString(value);
                        const { h, s /* ignore v */ } = conversions_1.conversions.rgbToHSV(r, g, b);
                        if (raw) {
                            me.hue = Math.round(h / 360 * predefined_colors_1.MAX_COLOR);
                            me.saturation = Math.round(s * predefined_colors_1.MAX_COLOR);
                        }
                        else {
                            me.hue = h;
                            me.saturation = s * 100;
                        }
                    }
                }
                break;
            }
            default: me[key] = value;
        }
        return true;
    }
    return { get, set };
}
590032
def send(self):
        

        for name, array in iteritems(self):

            shader_id = c_int(0)
            gl.glGetIntegerv(gl.GL_CURRENT_PROGRAM, byref(shader_id))
            if shader_id.value == 0:
                raise UnboundLocalError("""Shader not bound to OpenGL context--uniform cannot be sent.
                ------------ Tip -------------
                with ratcave.default_shader:
                    mesh.draw()
                ------------------------------
                """)

            # Attach a shader location value to the array, for quick memory lookup. (gl calls are expensive, for some reason)
            try:
                loc, shader_id_for_array = array.loc
                if shader_id.value != shader_id_for_array:
                    raise Exception('Uniform location bound to a different shader')
            except (AttributeError, Exception) as e:
                array.loc = (gl.glGetUniformLocation(shader_id.value, name.encode('ascii')), shader_id.value)

            if array.ndim == 2:  # Assuming a 4x4 float32 matrix (common for graphics operations)
                try:
                    pointer = array.pointer
                except AttributeError:
                    array.pointer = array.ctypes.data_as(POINTER(c_float * 16)).contents
                    pointer = array.pointer
                gl.glUniformMatrix4fv(array.loc[0], 1, True, pointer)

            else:
                sendfun = self._sendfuns[array.dtype.kind][len(array) - 1]  # Find correct glUniform function
                sendfun(array.loc[0], *array)
1247909
def shade(renderbuffer, bufferbbox, img3d, bbox):
  """"""

  if not Bbox.intersects(bufferbbox, bbox):
    return

  spt = max2(bbox.minpt, bufferbbox.minpt)
  ept = min2(bbox.maxpt, bufferbbox.maxpt)

  ZERO3 = Vec(0,0,0)

  istart = max2(spt - bbox.minpt, ZERO3)
  iend = min2(ept - bbox.maxpt, ZERO3) + img3d.shape[:3]

  rbox = Bbox(spt, ept) - bufferbbox.minpt
  if len(img3d.shape) == 3:
    img3d = img3d[ :, :, :, np.newaxis]
  
  renderbuffer[ rbox.to_slices() ] = img3d[ istart.x:iend.x, istart.y:iend.y, istart.z:iend.z, : ]
986126
function (data) {
    var angle = data.angle;
    var color = new THREE.Color(data.color);
    this.rendererSystem.applyColorCorrection(color);
    color = color.getHex();
    var decay = data.decay;
    var distance = data.distance;
    var groundColor = new THREE.Color(data.groundColor);
    this.rendererSystem.applyColorCorrection(groundColor);
    groundColor = groundColor.getHex();
    var intensity = data.intensity;
    var type = data.type;
    var target = data.target;
    var light = null;

    switch (type.toLowerCase()) {
      case 'ambient': {
        return new THREE.AmbientLight(color, intensity);
      }

      case 'directional': {
        light = new THREE.DirectionalLight(color, intensity);
        this.defaultTarget = light.target;
        if (target) {
          if (target.hasLoaded) {
            this.onSetTarget(target, light);
          } else {
            target.addEventListener('loaded', bind(this.onSetTarget, this, target, light));
          }
        }
        return light;
      }

      case 'hemisphere': {
        return new THREE.HemisphereLight(color, groundColor, intensity);
      }

      case 'point': {
        return new THREE.PointLight(color, intensity, distance, decay);
      }

      case 'spot': {
        light = new THREE.SpotLight(color, intensity, distance, degToRad(angle), data.penumbra, decay);
        this.defaultTarget = light.target;
        if (target) {
          if (target.hasLoaded) {
            this.onSetTarget(target, light);
          } else {
            target.addEventListener('loaded', bind(this.onSetTarget, this, target, light));
          }
        }
        return light;
      }

      default: {
        warn('%s is not a valid light type. ' +
           'Choose from ambient, directional, hemisphere, point, spot.', type);
      }
    }
  }
1025619
function InitShaders (gl, opts) {
  var numJoints = opts.numJoints

  var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER)
  var vertexShader = gl.createShader(gl.VERTEX_SHADER)

  gl.shaderSource(fragmentShader, fragment)
  gl.compileShader(fragmentShader)

  gl.shaderSource(vertexShader, vertex)
  gl.compileShader(vertexShader)

  var shaderProgram = gl.createProgram()
  gl.attachShader(shaderProgram, fragmentShader)
  gl.attachShader(shaderProgram, vertexShader)
  gl.linkProgram(shaderProgram)
  gl.useProgram(shaderProgram)

  var vertexPositionAttribute = gl.getAttribLocation(shaderProgram, 'aVertexPosition')
  gl.enableVertexAttribArray(vertexPositionAttribute)

  var vertexNormalAttribute = gl.getAttribLocation(shaderProgram, 'aVertexNormal')
  gl.enableVertexAttribArray(vertexNormalAttribute)

  var jointIndexAttribute = gl.getAttribLocation(shaderProgram, 'aJointIndex')
  gl.enableVertexAttribArray(jointIndexAttribute)

  var jointWeightAttribute = gl.getAttribLocation(shaderProgram, 'aJointWeight')
  gl.enableVertexAttribArray(jointWeightAttribute)

  var shaderObj = {
    ambientColorUniform: gl.getUniformLocation(shaderProgram, 'uAmbientColor'),
    lightingDirectionUniform: gl.getUniformLocation(shaderProgram, 'uLightingDirection'),
    directionalColorUniform: gl.getUniformLocation(shaderProgram, 'uDirectionalColor'),
    program: shaderProgram,
    vertexPositionAttribute: vertexPositionAttribute,
    vertexNormalAttribute: vertexNormalAttribute,
    jointIndexAttribute: jointIndexAttribute,
    jointWeightAttribute: jointWeightAttribute,
    samplerUniform: gl.getUniformLocation(shaderProgram, 'uSampler'),
    pMatrixUniform: gl.getUniformLocation(shaderProgram, 'uPMatrix'),
    mvMatrixUniform: gl.getUniformLocation(shaderProgram, 'uMVMatrix')
  }

  for (var jointNum = 0; jointNum < numJoints; jointNum++) {
    shaderObj['boneMatrix' + jointNum] = gl.getUniformLocation(shaderProgram, 'boneMatrices[' + jointNum + ']')
    // Split our dual quaternion into two vec4's since we can't use mat2x4 in WebGL
    shaderObj['boneRotQuaternion' + jointNum] = gl.getUniformLocation(shaderProgram, 'boneRotQuaternions[' + jointNum + ']')
    shaderObj['boneTransQuaternion' + jointNum] = gl.getUniformLocation(shaderProgram, 'boneTransQuaternions[' + jointNum + ']')
  }

  return shaderObj
}
660972
function shader (color, percent) {
  const parseStrIndex = 16;
  const sliceStrIndex = 1;

  // Throw an error for colors
  if ((percent != 0) && (percent > 1.0 || -1.0 > percent)) {
    throw new Error(`Color Shader Error: unable shade accurately "${color}" by "${percent}" amount. The amount must be less than 1.0 and greater than -1.0.`);
  }

  let f;

  // Handle different string lengths
  switch (color.length) {

    // In the case of a 3 char string like fff...
    // ...then double the chars and parse the hex.
    case 3:
      color = color + color;
      f = parseInt(color, parseStrIndex);
      break;

    // In the case of a 4 char string like #fff...
    // ...then remove the hash, double the chars and parse the hex.
    case 4:
      color = color.slice(sliceStrIndex);
      color = color + color;
      f = parseInt(color, parseStrIndex);
      break;

    // In the case of a 7 char string like #ffffff,
    // ...then remove the hash and parse the hex.
    case 7:
      f = parseInt(color.slice(sliceStrIndex), parseStrIndex);
      break;

    // In the case of a 6 char string like ffffff...
    // ...then parse the hex without doing anything.
    default:
      f = parseInt(color, parseStrIndex);
      break;
  }

  const t = percent < 0 ? 0 : 255;
  const p = percent < 0 ? percent *- 1 : percent;

  // Old RGB values
  const r = f >> 16
  const g = f >> 8 & 0x00FF
  const b = f & 0x0000FF

  // Return new hex code
  return `#${
    (
      0x1000000 + (Math.round((t - r) * p) + r) * 0x10000 +
      (Math.round((t - g) * p) + g) * 0x100 +
      (Math.round((t - b) * p) + b)
    ).toString(16).slice(1)
  }`;
}
212946
function shadeColor(col, amount) {
  let col1rgb = parseColor(col);
  return RGBobj2string({
    r: Math.min(255, col1rgb.r * amount + 0 * Math.max(0,1-amount)),
    g: Math.min(255, col1rgb.g * amount + 0 * Math.max(0,1-amount)),
    b: Math.min(255, col1rgb.b * amount + 0 * Math.max(0,1-amount)),
    a: col1rgb.a
  });
}
571610
def createAllShaders(self):
        ""
        self.m_unSceneProgramID = self.compileGLShader( 
            "Scene",
            # Vertex Shader
            dedent("""\
            #version 410
            uniform mat4 matrix;
            layout(location = 0) in vec4 position;
            layout(location = 1) in vec2 v2UVcoordsIn;
            layout(location = 2) in vec3 v3NormalIn;
            out vec2 v2UVcoords;
            void main()
            {
                v2UVcoords = v2UVcoordsIn;
                gl_Position = matrix * position;
            }
            """),
            # Fragment Shader
            dedent("""\
            #version 410 core
            uniform sampler2D mytexture;
            in vec2 v2UVcoords;
            out vec4 outputColor;
            void main()
            {
               outputColor = texture(mytexture, v2UVcoords);
            }
            """)
            )
        self.m_nSceneMatrixLocation = glGetUniformLocation( self.m_unSceneProgramID, "matrix" )
        if self.m_nSceneMatrixLocation == -1:
            dprintf( "Unable to find matrix uniform in scene shader\n" )
            return False
        self.m_unControllerTransformProgramID = self.compileGLShader(
            "Controller",
            # vertex shader
            dedent("""\
            #version 410
            uniform mat4 matrix;
            layout(location = 0) in vec4 position;
            layout(location = 1) in vec3 v3ColorIn;
            out vec4 v4Color;
            void main()
            {
                v4Color.xyz = v3ColorIn;
                v4Color.a = 1.0;
                gl_Position = matrix * position;
            }
            """),
            # fragment shader
            dedent("""\
            #version 410
            in vec4 v4Color;
            out vec4 outputColor;
            void main()
            {
               outputColor = v4Color;
            }
            """) )
        self.m_nControllerMatrixLocation = glGetUniformLocation( self.m_unControllerTransformProgramID, "matrix" )
        if self.m_nControllerMatrixLocation == -1:
            dprintf( "Unable to find matrix uniform in controller shader\n" )
            return False
        self.m_unRenderModelProgramID = self.compileGLShader( 
            "render model",
            # vertex shader
            dedent("""\
            #version 410
            uniform mat4 matrix;
            layout(location = 0) in vec4 position;
            layout(location = 1) in vec3 v3NormalIn;
            layout(location = 2) in vec2 v2TexCoordsIn;
            out vec2 v2TexCoord;
            void main()
            {
                v2TexCoord = v2TexCoordsIn;
                gl_Position = matrix * vec4(position.xyz, 1);
            }
            """),
            #fragment shader
            dedent("""\
            #version 410 core
            uniform sampler2D diffuse;
            in vec2 v2TexCoord;
            out vec4 outputColor;
            void main()
            {
               outputColor = texture( diffuse, v2TexCoord);
            }
            """) )
        self.m_nRenderModelMatrixLocation = glGetUniformLocation( self.m_unRenderModelProgramID, "matrix" )
        if self.m_nRenderModelMatrixLocation == -1:
            dprintf( "Unable to find matrix uniform in render model shader\n" )
            return False
        self.m_unLensProgramID = self.compileGLShader(
            "Distortion",
            # vertex shader
            dedent("""\
            #version 410 core
            layout(location = 0) in vec4 position;
            layout(location = 1) in vec2 v2UVredIn;
            layout(location = 2) in vec2 v2UVGreenIn;
            layout(location = 3) in vec2 v2UVblueIn;
            noperspective  out vec2 v2UVred;
            noperspective  out vec2 v2UVgreen;
            noperspective  out vec2 v2UVblue;
            void main()
            {
                v2UVred = v2UVredIn;
                v2UVgreen = v2UVGreenIn;
                v2UVblue = v2UVblueIn;
                gl_Position = position;
            }
            """),
            # fragment shader
            dedent("""\
            #version 410 core
            uniform sampler2D mytexture;
    
            noperspective  in vec2 v2UVred;
            noperspective  in vec2 v2UVgreen;
            noperspective  in vec2 v2UVblue;
    
            out vec4 outputColor;
    
            void main()
            {
                float fBoundsCheck = ( 
                    (dot( vec2( lessThan( v2UVgreen.xy, vec2(0.05, 0.05)) ), vec2(1.0, 1.0))
                    + dot( vec2( greaterThan( v2UVgreen.xy, vec2( 0.95, 0.95)) ), vec2(1.0, 1.0))) 
                    );
                if( fBoundsCheck > 1.0 ) {
                    outputColor = vec4( 0, 0, 0, 1.0 ); 
                } 
                else {
                    float red = texture(mytexture, v2UVred).x;
                    float green = texture(mytexture, v2UVgreen).y;
                    float blue = texture(mytexture, v2UVblue).z;
                    outputColor = vec4( red, green, blue, 1.0  ); 
                }
            }
            """) )
        return self.m_unSceneProgramID != 0 and self.m_unControllerTransformProgramID != 0 and self.m_unRenderModelProgramID != 0 and self.m_unLensProgramID != 0
1356704
function createVisualization(data) {
  var json = buildHierarchy(data);

  // Basic setup of page elements.
  initializeBreadcrumbTrail();

  // Bounding circle underneath the sunburst, to make it easier to detect
  // when the mouse leaves the parent g.
  vis.append("svg:circle")
      .attr("r", radius)
      .style("opacity", 0);

  // For efficiency, filter nodes to keep only those large enough to see.
  var nodes = partition.nodes(json)
      .filter(function(d) {
      return (d.dx > 0.005); // 0.005 radians = 0.29 degrees
      });

  var path = vis.data([json]).selectAll("path")
      .data(nodes)
      .enter().append("svg:path")
      .attr("display", function(d) { return d.depth ? null : "none"; })
      .attr("d", arc)
      .attr("fill-rule", "evenodd")
      .style("fill", function(d) { return colors[d.depth]; })
      .style("opacity", 1)
      .on("mouseover", mouseover);

  // Add the mouseleave handler to the bounding circle.
  d3.select("#container").on("mouseleave", mouseleave);

  // Get total size of the tree = value of root node from partition.
  totalSize = path.node().__data__.value;
 }
1232990
private void ShapePostParsing() {
        if (!gvrRenderingDataUSEd) {
            // SHAPE node not being USEd (shared) elsewhere

            // Shape containts Text
            if (gvrTextViewSceneObject != null) {
                gvrTextViewSceneObject.setTextColor((((0xFF << 8)
                        + (int) (shaderSettings.diffuseColor[0] * 255) << 8)
                        + (int) (shaderSettings.diffuseColor[1] * 255) << 8)
                        + (int) (shaderSettings.diffuseColor[2] * 255));
                gvrTextViewSceneObject = null;
            }

            {
                // UNIVERSAL_LIGHTS

                if (!gvrMaterialUSEd) { // if GVRMaterial is NOT set by a USE statement.

                    if (meshAttachedSceneObject == null) {
                        gvrMaterial = shaderSettings.material;
                        gvrRenderData.setMaterial(gvrMaterial);
                    } else {
                        // This GVRSceneObject came with a GVRRenderData and GVRMaterial
                        // already attached.  Examples of this are Text or primitives
                        // such as the Box, Cone, Cylinder, Sphere

                        DefinedItem definedGRRenderingData = null;
                        if (gvrRenderData != null) {
                            // <Shape> node created an unused gvrRenderData
                            // Check if we had a DEF in Shape node so that we can point to
                            // the new gvrRenderData
                            for (DefinedItem definedItem : mDefinedItems) {
                                if (definedItem.getGVRRenderData() == gvrRenderData) {
                                    definedGRRenderingData = definedItem;
                                    break;
                                }
                            }
                        }
                        gvrRenderData = meshAttachedSceneObject.getRenderData();
                        // reset the DEF item to now point to the shader
                        if (definedGRRenderingData != null)
                            definedGRRenderingData.setGVRRenderData(gvrRenderData);
                        gvrMaterial = gvrRenderData.getMaterial();
                    }
                    // X3D doesn't have an ambient color so need to do color
                    // calibration tests on how to set this.
                    gvrMaterial.setVec4("diffuse_color",
                            shaderSettings.diffuseColor[0],
                            shaderSettings.diffuseColor[1],
                            shaderSettings.diffuseColor[2],
                            (1.0f - shaderSettings.getTransparency()) );
                    gvrMaterial.setVec4("specular_color",
                            shaderSettings.specularColor[0],
                            shaderSettings.specularColor[1],
                            shaderSettings.specularColor[2], 1.0f);
                    gvrMaterial.setVec4("emissive_color",
                            shaderSettings.emissiveColor[0],
                            shaderSettings.emissiveColor[1],
                            shaderSettings.emissiveColor[2], 1.0f);
                    gvrMaterial.setFloat("specular_exponent",
                            128.0f * shaderSettings.shininess);

                    if (!shaderSettings.getMaterialName().isEmpty()) {
                        DefinedItem definedItem = new DefinedItem(
                                shaderSettings.getMaterialName());
                        definedItem.setGVRMaterial(gvrMaterial);
                        mDefinedItems.add(definedItem); // Add gvrMaterial to Array list
                        // of DEFined items Clones
                        // objects with USE
                    }

                    if ( shaderSettings.getMultiTexture()) {
                        if ( !shaderSettings.getMultiTextureName().isEmpty() ) {
                            DefinedItem definedItem = new DefinedItem(
                                    shaderSettings.getMultiTextureName() );
                            definedItem.setGVRMaterial(gvrMaterial);
                            mDefinedItems.add(definedItem); // Add gvrMaterial to Array list
                        }
                        gvrMaterial.setTexture("diffuseTexture", shaderSettings.getMultiTextureGVRTexture(0) );
                        gvrMaterial.setTexture("diffuseTexture1", shaderSettings.getMultiTextureGVRTexture(1) );
                        // 0:Mul; 1=for ADD; 2 for SUBTRACT; 3 for DIVIDE; 4=smooth add; 5=Signed add
                        gvrMaterial.setInt("diffuseTexture1_blendop", shaderSettings.getMultiTextureMode().ordinal());
                        gvrMaterial.setTexCoord("diffuseTexture", "a_texcoord", "diffuse_coord");
                        gvrMaterial.setTexCoord("diffuseTexture1", "a_texcoord", "diffuse_coord1");

                    }
                    else if (shaderSettings.texture != null) {
                        gvrMaterial.setTexture("diffuseTexture",
                                shaderSettings.texture);
                        // if the TextureMap is a DEFined item, then set the
                        // GVRMaterial to it as well to help if we set the
                        // in a SCRIPT node.
                        for (DefinedItem definedItem: mDefinedItems) {
                            if ( definedItem.getGVRTexture() == shaderSettings.texture) {
                                definedItem.setGVRMaterial(gvrMaterial);
                                break;
                            }
                        }
                    }

                    if ( !shaderSettings.movieTextures.isEmpty()) {
                        try {
                            GVRVideoSceneObjectPlayer<?> videoSceneObjectPlayer = null;
                            try {
                                videoSceneObjectPlayer = utility.makeExoPlayer(shaderSettings.movieTextures.get(0));
                            }
                            catch (Exception e) {
                                Log.e(TAG, "Exception getting videoSceneObjectPlayer: " + e);
                            }
                            videoSceneObjectPlayer.start();

                            GVRVideoSceneObject gvrVideoSceneObject =
                                    new GVRVideoSceneObject(gvrContext, gvrRenderData.getMesh(), videoSceneObjectPlayer,
                                            GVRVideoSceneObject.GVRVideoType.MONO);
                            currentSceneObject.addChildObject(gvrVideoSceneObject);
                            // Primitives such as Box, Cone, etc come with their own mesh
                            // so we need to remove these.
                            if ( meshAttachedSceneObject != null) {
                                GVRSceneObject primitiveParent = meshAttachedSceneObject.getParent();
                                primitiveParent.removeChildObject(meshAttachedSceneObject);
                            }
                            meshAttachedSceneObject = gvrVideoSceneObject;

                            if (shaderSettings.getMovieTextureName() != null) {
                                gvrVideoSceneObject.setName(shaderSettings.getMovieTextureName());
                                DefinedItem item = new DefinedItem(shaderSettings.getMovieTextureName());
                                item.setGVRVideoSceneObject(gvrVideoSceneObject);
                                mDefinedItems.add(item);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                            Log.e(TAG, "X3D MovieTexture Exception:\n" + e);
                        }
                    }  // end MovieTexture

                    // Texture Transform
                    // If DEFined iteam, add to the DeFinedItem list. Maay be interactive
                    // GearVR may not be doing texture transforms on primitives or text
                    // crash otherwise.

                    if (meshAttachedSceneObject == null) {
                        if (!shaderSettings.getTextureTransformName().isEmpty()) {
                            DefinedItem definedItem = new DefinedItem(
                                    shaderSettings.getTextureTransformName());
                            definedItem.setGVRMaterial(gvrMaterial);
                            definedItem.setTextureTranslation(shaderSettings.getTextureTranslation());
                            definedItem.setTextureCenter(shaderSettings.getTextureCenter());
                            definedItem.setTextureScale(shaderSettings.getTextureScale());
                            definedItem.setTextureRotation(shaderSettings.getTextureRotation().getValue());
                            definedItem.setName(shaderSettings.getTextureTransformName());
                            mDefinedItems.add(definedItem); // Add gvrMaterial to Array list
                        }
                        // Texture Transform Matrix equation:
                        // TC' = -C * S * R * C * T * TC
                        //where TC' is the transformed texture coordinate
                        //   TC is the original Texture Coordinate
                        //   C = center, S = scale, R = rotation, T = translation
                        Matrix3f textureTransform = animationInteractivityManager.SetTextureTransformMatrix(
                                shaderSettings.getTextureTranslation(),
                                shaderSettings.getTextureCenter(),
                                shaderSettings.getTextureScale(),
                                shaderSettings.getTextureRotation());

                        shaderSettings.textureMatrix = textureTransform;
                        float[] texMtx = new float[9];
                        shaderSettings.textureMatrix.get(texMtx);
                        gvrMaterial.setFloatArray("texture_matrix", texMtx);
                    }

                    // Appearance node thus far contains properties of GVRMaterial
                    // node
                    if (!shaderSettings.getAppearanceName().isEmpty()) {
                        DefinedItem definedItem = new DefinedItem(
                                shaderSettings.getAppearanceName());
                        definedItem.setGVRMaterial(gvrMaterial);
                        mDefinedItems.add(definedItem);
                        // Add gvrMaterial to Array list
                        // of DEFined items Clones
                        // objects with USE
                    }

                    if ((shaderSettings.getTransparency() != 0) && (shaderSettings.getTransparency() != 1)) {
                        gvrRenderData.setRenderingOrder(GVRRenderingOrder.TRANSPARENT);
                    }

                } // end ! gvrMaterialUSEd

                gvrTexture = null;
            }
        } // end !gvrRenderingDataUSEd

        if (meshAttachedSceneObject != null) {
            // gvrRenderData already attached to a GVRSceneObject such as a
            // Cone or Cylinder or a Movie Texture
            meshAttachedSceneObject = null;
        } else
            currentSceneObject.attachRenderData(gvrRenderData);

        if (lodManager.shapeLODSceneObject != null) {
            // if this Shape node was a direct child of a
            // Level-of-Detial (LOD),then restore the parent object
            // since we had to add a GVRSceneObject to support
            // the Shape node's attachement to LOD.
            currentSceneObject = currentSceneObject.getParent();
            lodManager.shapeLODSceneObject = null;
        }

        gvrMaterialUSEd = false; // for DEFine and USE, true if we encounter a
        // USE
        gvrRenderingDataUSEd = false; // for DEFine and USE gvrRenderingData for
        // x3d SHAPE node
        gvrRenderData = null;

    }
774580
function createShaderProgram(gl, shaders) {
  const program = gl.createProgram();

  for (let i = 0; i < shaders.length; i++) {
    gl.attachShader(program, shaders[i]);
  }

  gl.linkProgram(program);

  // Check the link status
  const linked = gl.getProgramParameter(program, gl.LINK_STATUS);
  if (!linked) {
    // something went wrong with the link
    const lastError = gl.getProgramInfoLog(program);
    console.error('Error in program linking:', lastError);
    gl.deleteProgram(program);

    return null;
  }

  program.shaders = shaders;
  gl.useProgram(program);

  return program;
}
1119152
function (renderer, attribList, vao) {
        var _gl = renderer.gl;
        var program = this._program;

        var locationMap = this._locations;

        var enabledAttributeListInContext;
        if (vao) {
            enabledAttributeListInContext = vao.__enabledAttributeList;
        }
        else {
            enabledAttributeListInContext = enabledAttributeList[renderer.__uid__];
        }
        if (!enabledAttributeListInContext) {
            // In vertex array object context
            // PENDING Each vao object needs to enable attributes again?
            if (vao) {
                enabledAttributeListInContext
                    = vao.__enabledAttributeList
                    = [];
            }
            else {
                enabledAttributeListInContext
                    = enabledAttributeList[renderer.__uid__]
                    = [];
            }
        }
        var locationList = [];
        for (var i = 0; i < attribList.length; i++) {
            var symbol = attribList[i];
            if (!this.attributes[symbol]) {
                locationList[i] = -1;
                continue;
            }
            var location = locationMap[symbol];
            if (location == null) {
                location = _gl.getAttribLocation(program, symbol);
                // Attrib location is a number from 0 to ...
                if (location === -1) {
                    locationList[i] = -1;
                    continue;
                }
                locationMap[symbol] = location;
            }
            locationList[i] = location;

            if (!enabledAttributeListInContext[location]) {
                enabledAttributeListInContext[location] = SHADER_STATE_TO_ENABLE;
            }
            else {
                enabledAttributeListInContext[location] = SHADER_STATE_KEEP_ENABLE;
            }
        }

        for (var i = 0; i < enabledAttributeListInContext.length; i++) {
            switch(enabledAttributeListInContext[i]){
                case SHADER_STATE_TO_ENABLE:
                    _gl.enableVertexAttribArray(i);
                    enabledAttributeListInContext[i] = SHADER_STATE_PENDING;
                    break;
                case SHADER_STATE_KEEP_ENABLE:
                    enabledAttributeListInContext[i] = SHADER_STATE_PENDING;
                    break;
                // Expired
                case SHADER_STATE_PENDING:
                    _gl.disableVertexAttribArray(i);
                    enabledAttributeListInContext[i] = 0;
                    break;
            }
        }

        return locationList;
    }
1268612
function createShader(
    gl
  , vertSource
  , fragSource
  , uniforms
  , attributes) {
  
  //Compile vertex shader
  var vertShader = gl.createShader(gl.VERTEX_SHADER)
  gl.shaderSource(vertShader, vertSource)
  gl.compileShader(vertShader)
  if(!gl.getShaderParameter(vertShader, gl.COMPILE_STATUS)) {
    var errLog = gl.getShaderInfoLog(vertShader)
    console.error('gl-shader: Error compling vertex shader:', errLog)
    throw new Error('gl-shader: Error compiling vertex shader:' + errLog)
  }
  
  //Compile fragment shader
  var fragShader = gl.createShader(gl.FRAGMENT_SHADER)
  gl.shaderSource(fragShader, fragSource)
  gl.compileShader(fragShader)
  if(!gl.getShaderParameter(fragShader, gl.COMPILE_STATUS)) {
    var errLog = gl.getShaderInfoLog(fragShader)
    console.error('gl-shader: Error compiling fragment shader:', errLog)
    throw new Error('gl-shader: Error compiling fragment shader:' + errLog)
  }
  
  //Link program
  var program = gl.createProgram()
  gl.attachShader(program, fragShader)
  gl.attachShader(program, vertShader)

  //Optional default attriubte locations
  attributes.forEach(function(a) {
    if (typeof a.location === 'number') 
      gl.bindAttribLocation(program, a.location, a.name)
  })

  gl.linkProgram(program)
  if(!gl.getProgramParameter(program, gl.LINK_STATUS)) {
    var errLog = gl.getProgramInfoLog(program)
    console.error('gl-shader: Error linking shader program:', errLog)
    throw new Error('gl-shader: Error linking shader program:' + errLog)
  }
  
  //Return final linked shader object
  var shader = new Shader(
    gl,
    program,
    vertShader,
    fragShader
  )
  shader.updateExports(uniforms, attributes)

  return shader
}
185422
def _createGsshaPyObjects(self, cell):
        
        # Initialize GSSHAPY PipeGridCell object
        gridCell = GridStreamCell(cellI=cell['i'],
                                  cellJ=cell['j'],
                                  numNodes=cell['numNodes'])

        # Associate GridStreamCell with GridStreamFile
        gridCell.gridStreamFile = self

        for linkNode in cell['linkNodes']:
            # Create GSSHAPY GridStreamNode object
            gridNode = GridStreamNode(linkNumber=linkNode['linkNumber'],
                                      nodeNumber=linkNode['nodeNumber'],
                                      nodePercentGrid=linkNode['percent'])

            # Associate GridStreamNode with GridStreamCell
            gridNode.gridStreamCell = gridCell
89989
function ( materialNode, textureMap, ID ) {

			var parameters = {};

			if ( materialNode.BumpFactor ) {

				parameters.bumpScale = materialNode.BumpFactor.value;

			}
			if ( materialNode.Diffuse ) {

				parameters.color = new THREE.Color().fromArray( materialNode.Diffuse.value );

			} else if ( materialNode.DiffuseColor && materialNode.DiffuseColor.type === 'Color' ) {

				// The blender exporter exports diffuse here instead of in materialNode.Diffuse
				parameters.color = new THREE.Color().fromArray( materialNode.DiffuseColor.value );

			}
			if ( materialNode.DisplacementFactor ) {

				parameters.displacementScale = materialNode.DisplacementFactor.value;

			}
			if ( materialNode.Emissive ) {

				parameters.emissive = new THREE.Color().fromArray( materialNode.Emissive.value );

			} else if ( materialNode.EmissiveColor && materialNode.EmissiveColor.type === 'Color' ) {

				// The blender exporter exports emissive color here instead of in materialNode.Emissive
				parameters.emissive = new THREE.Color().fromArray( materialNode.EmissiveColor.value );

			}
			if ( materialNode.EmissiveFactor ) {

				parameters.emissiveIntensity = parseFloat( materialNode.EmissiveFactor.value );

			}
			if ( materialNode.Opacity ) {

				parameters.opacity = parseFloat( materialNode.Opacity.value );

			}
			if ( parameters.opacity < 1.0 ) {

				parameters.transparent = true;

			}
			if ( materialNode.ReflectionFactor ) {

				parameters.reflectivity = materialNode.ReflectionFactor.value;

			}
			if ( materialNode.Shininess ) {

				parameters.shininess = materialNode.Shininess.value;

			}
			if ( materialNode.Specular ) {

				parameters.specular = new THREE.Color().fromArray( materialNode.Specular.value );

			} else if ( materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color' ) {

				// The blender exporter exports specular color here instead of in materialNode.Specular
				parameters.specular = new THREE.Color().fromArray( materialNode.SpecularColor.value );

			}

			var self = this;
			connections.get( ID ).children.forEach( function ( child ) {

				var type = child.relationship;

				switch ( type ) {

					case 'Bump':
						parameters.bumpMap = self.getTexture( textureMap, child.ID );
						break;

					case 'DiffuseColor':
						parameters.map = self.getTexture( textureMap, child.ID );
						break;

					case 'DisplacementColor':
						parameters.displacementMap = self.getTexture( textureMap, child.ID );
						break;


					case 'EmissiveColor':
						parameters.emissiveMap = self.getTexture( textureMap, child.ID );
						break;

					case 'NormalMap':
						parameters.normalMap = self.getTexture( textureMap, child.ID );
						break;

					case 'ReflectionColor':
						parameters.envMap = self.getTexture( textureMap, child.ID );
						parameters.envMap.mapping = THREE.EquirectangularReflectionMapping;
						break;

					case 'SpecularColor':
						parameters.specularMap = self.getTexture( textureMap, child.ID );
						break;

					case 'TransparentColor':
						parameters.alphaMap = self.getTexture( textureMap, child.ID );
						parameters.transparent = true;
						break;

					case 'AmbientColor':
					case 'ShininessExponent': // AKA glossiness map
					case 'SpecularFactor': // AKA specularLevel
					case 'VectorDisplacementColor': // NOTE: Seems to be a copy of DisplacementColor
					default:
						console.warn( 'THREE.FBXLoader: %s map is not supported in three.js, skipping texture.', type );
						break;

				}

			} );

			return parameters;

		}