SgMeshBase::SgMeshBase(const SgMeshBase& org, SgCloneMap& cloneMap)
    : SgObject(org),
      normalIndices_(org.normalIndices_),
      colorIndices_(org.colorIndices_),
      texCoordIndices_(org.texCoordIndices_)
{
    if(cloneMap.isNonNodeCloningEnabled()){
        if(org.vertices_){
            setVertices(cloneMap.getClone<SgVertexArray>(org.vertices()));
        }
        if(org.normals_){
            setNormals(cloneMap.getClone<SgNormalArray>(org.normals()));
        }
        if(org.colors_){
            setColors(cloneMap.getClone<SgColorArray>(org.colors()));
        }
        if(org.texCoords_){
            setTexCoords(cloneMap.getClone<SgTexCoordArray>(org.texCoords()));
        }
    } else {
        setVertices(const_cast<SgVertexArray*>(org.vertices()));
        setNormals(const_cast<SgNormalArray*>(org.normals()));
        setColors(const_cast<SgColorArray*>(org.colors()));
        setTexCoords(const_cast<SgTexCoordArray*>(org.texCoords()));
    }
    isSolid_ = org.isSolid_;
    bbox = org.bbox;
}
Example #2
0
SgTexture::SgTexture(const SgTexture& org, SgCloneMap& cloneMap)
    : SgObject(org)
{
    if(cloneMap.isNonNodeCloningEnabled()){
        if(org.image()){
            setImage(cloneMap.getClone<SgImage>(org.image()));
        }
        if(org.textureTransform()){
            setTextureTransform(cloneMap.getClone<SgTextureTransform>(org.textureTransform()));
        }
    } else {
        setImage(const_cast<SgImage*>(org.image()));
        setTextureTransform(const_cast<SgTextureTransform*>(org.textureTransform()));
    }
    
    repeatS_ = org.repeatS_;
    repeatT_ = org.repeatT_;
}
Example #3
0
SgShape::SgShape(const SgShape& org, SgCloneMap& cloneMap)
    : SgNode(org)
{
    if(cloneMap.isNonNodeCloningEnabled()){
        if(org.mesh()){
            setMesh(cloneMap.getClone<SgMesh>(org.mesh()));
        }
        if(org.material()){
            setMaterial(cloneMap.getClone<SgMaterial>(org.material()));
        }
        if(org.texture()){
            setTexture(cloneMap.getClone<SgTexture>(org.texture()));
        }
    } else {
        setMesh(const_cast<SgMesh*>(org.mesh()));
        setMaterial(const_cast<SgMaterial*>(org.material()));
        setTexture(const_cast<SgTexture*>(org.texture()));
    }
}
Example #4
0
SgPlot::SgPlot(const SgPlot& org, SgCloneMap& cloneMap)
    : SgNode(org)
{
    if(cloneMap.isNonNodeCloningEnabled()){
        if(org.vertices()){
            setVertices(cloneMap.getClone<SgVertexArray>(org.vertices()));
        }
        if(org.colors()){
            setColors(cloneMap.getClone<SgColorArray>(org.colors()));
        }
        if(org.material()){
            setMaterial(cloneMap.getClone<SgMaterial>(org.material()));
        }
    } else {
        setVertices(const_cast<SgVertexArray*>(org.vertices()));
        setColors(const_cast<SgColorArray*>(org.colors()));
        setMaterial(const_cast<SgMaterial*>(org.material()));
    }
    normalIndices_ = org.normalIndices_;
    colorIndices_ = org.colorIndices_;
    bbox = org.bbox;
}
Example #5
0
void SceneBody::makeTransparent(float transparency)
{
    SgCloneMap cloneMap;
    cloneMap.setNonNodeCloning(false);
    makeTransparent(transparency, cloneMap);
}