Exemple #1
0
void bindAndSetUniforms(Shader& shader, TextureUnitContainer& cont, VolumeInport& volumePort) {
    TextureUnit unit;
    utilgl::bindTexture(volumePort, unit);
    shader.setUniform(volumePort.getIdentifier(), unit.getUnitNumber());
    utilgl::setShaderUniforms(shader, volumePort, volumePort.getIdentifier() + "Parameters");
    cont.push_back(std::move(unit));
}
Exemple #2
0
void CameraProperty::inportChanged() {
    if (!adjustCameraOnDataChange_) return;

    VolumeInport* volumeInport = dynamic_cast<VolumeInport*>(inport_);
    MeshInport* meshInport = dynamic_cast<MeshInport*>(inport_);

    // using SpatialEntity since Geometry is not derived from data
    const SpatialEntity<3>* data = nullptr;

    if (volumeInport) {
        data = volumeInport->getData().get();
    } else if (meshInport) {
        data = meshInport->getData().get();
    }

    if (data_ == nullptr && prevDataToWorldMatrix_ == mat4(0.0f)) {  // first time only
        if (volumeInport && volumeInport->hasData()) {
            prevDataToWorldMatrix_ =
                volumeInport->getData()->getCoordinateTransformer().getDataToWorldMatrix();
        } else if (meshInport && meshInport->hasData()) {
            prevDataToWorldMatrix_ =
                meshInport->getData()->getCoordinateTransformer().getDataToWorldMatrix();
        }
    } else if (data && data_ != data) {
        adjustCameraToData(prevDataToWorldMatrix_,
                           data->getCoordinateTransformer().getDataToWorldMatrix());
    }

    data_ = data;
}
Exemple #3
0
void setShaderUniforms(Shader& shader, const VolumeInport& port, const std::string& samplerID) {
    setShaderUniforms(shader, *port.getData(), samplerID);
}
Exemple #4
0
void bindTexture(const VolumeInport& inport, const TextureUnit& texUnit) {
    bindTexture(*inport.getData(), texUnit);
}