コード例 #1
0
void MultiVolumeProxyGeometry::process() {
    tgtAssert(inport_.getData()->getVolume(), "no volume");
    tgtAssert(geometry_, "no geometry object");

    geometry_->clear();
    std::vector<VolumeHandle*> data = inport_.getAllData();
    for(size_t d=0; d<data.size(); ++d) {
        if(!data[d])
            continue;

        Volume* volume = data[d]->getVolume();
        tgt::vec3 volumeSize = volume->getCubeSize();

        tgt::vec3 coordLlf = -(volumeSize / static_cast<tgt::vec3::ElemType>(2));
        tgt::vec3 coordUrb =  (volumeSize / static_cast<tgt::vec3::ElemType>(2));

        MeshGeometry mesh = MeshGeometry::createCube(coordLlf, coordUrb, coordLlf, coordUrb);
        //apply dataset transformation matrix:
        mesh.transform(volume->getTransformation());

        //reset tex coords to coords after transformation:
        for(size_t j=0; j<mesh.getFaceCount(); ++j) {
            FaceGeometry& fg = mesh.getFace(j);
            for(size_t k=0; k<fg.getVertexCount(); ++k) {
                VertexGeometry& vg = fg.getVertex(k);
                vg.setTexCoords(vg.getCoords());
            }
        }
        geometry_->addMesh(mesh);
    }

    outport_.setData(geometry_);
}
コード例 #2
0
void MultiVolumeProxyGeometry::process() {
    tgtAssert(inport_.getData()->getRepresentation<VolumeRAM>(), "no volume");

    MeshListGeometry* geometry = new MeshListGeometry();

    std::vector<const VolumeBase*> data = inport_.getAllData();
    for(size_t d=0; d<data.size(); ++d) {
        if(!data[d])
            continue;

        const VolumeBase* volume = data[d];

        tgt::vec3 coordLlf = volume->getLLF();
        tgt::vec3 coordUrb = volume->getURB();


        MeshGeometry mesh = MeshGeometry::createCube(coordLlf, coordUrb, coordLlf, coordUrb);
        //apply dataset transformation matrix:
        mesh.transform(volume->getPhysicalToWorldMatrix());

        //reset tex coords to coords after transformation:
        for(size_t j=0; j<mesh.getFaceCount(); ++j) {
            FaceGeometry& fg = mesh.getFace(j);
            for(size_t k=0; k<fg.getVertexCount(); ++k) {
                VertexGeometry& vg = fg.getVertex(k);
                vg.setTexCoords(vg.getCoords());
            }
        }
        geometry->addMesh(mesh);
    }

    outport_.setData(geometry);
}