As far as i know, to have the subgeometry work it must be wrapped by a
submesh, and that submesh must be inside a mesh.

Cloning the subgeometry won't work unless you put it inside a mesh.

Anyone who knows this better may provide some help, but i think it works
like the way described above.

2011/5/10 rjgtav <[email protected]>

> Cloning a SubGeometry gives an error:
>
>  TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
>
> at line 261:
>
>  public function clone() : SubGeometry
> {
> var clone : SubGeometry = new SubGeometry();
> clone.updateVertexData(_vertices.concat());
> clone.updateUVData(_uvs.concat());
> clone.updateSecondaryUVData(_secondaryUvs.concat());// This line
> clone.updateIndexData(_indices.concat());
> if (!_autoDeriveVertexNormals)
> clone.updateVertexNormalData(_vertexNormals.concat());
> if (!_autoDeriveVertexTangents)
> clone.updateVertexTangentData(_vertexTangents.concat());
> return clone;
> }
>
> And if i trace the _secondaryUvs, it returns null.
> Source:
>
>  var primCube:Cube = new Cube(new ColorMaterial(0x888888), CUBESIZE,
> CUBESIZE, CUBESIZE);
> _view.scene.addChild(primCube)
>
> var cubeSubGeom:SubGeometry = primCube.geometry.subGeometries[0];
> var newSubGeom:SubGeometry = cubeSubGeom.clone();
>

Reply via email to