예제 #1
0
ISORaycaster::ISORaycaster()
    : Processor()
    , shader_("isoraycasting.frag", false)
    , volumePort_("volume")
    , entryPort_("entry")
    , exitPort_("exit")
    , outport_("outport")
    , channel_("channel", "Render Channel")
    , raycasting_("raycasting", "Raycasting")
    , camera_("camera", "Camera", vec3(0.0f, 0.0f, 3.5f), vec3(0.0f, 0.0f, 0.0f),
              vec3(0.0f, 1.0f, 0.0f)) 
    , lighting_("lighting", "Lighting", &camera_)
{
    shader_.onReload([this]() { invalidate(InvalidationLevel::InvalidResources); });

    addPort(volumePort_, "VolumePortGroup");
    addPort(entryPort_, "ImagePortGroup1");
    addPort(exitPort_, "ImagePortGroup1");
    addPort(outport_, "ImagePortGroup1");

    volumePort_.onChange(this, &ISORaycaster::onVolumeChange);

    addProperty(channel_);
    addProperty(raycasting_);
    addProperty(camera_);
    addProperty(lighting_);

    std::stringstream ss;
    ss << "Channel " << 0;
    channel_.addOption(ss.str() , ss.str(), 0);

    raycasting_.compositingMode_.setVisible(false);
    setAllPropertiesCurrentStateAsDefault();
}
예제 #2
0
HeightFieldMapper::HeightFieldMapper()
    : Processor()
    , inport_("image.inport", true)
    , outport_("image.outport", DataFloat32::get())
    , scalingModeProp_("scalingmode", "Scaling Mode")
    , heightRange_("heightrange", "Height Range", 0.0f, 1.0f, -1.0e1f, 1.0e1f)
    , maxHeight_("maxheight", "Maximum Height", 1.0f, 0.0f, 1.0e1f)
    , seaLevel_("sealevel", "Sea Level", 0.0f, -1.0e1f, 1.0e1f) {
    addPort(inport_);
    addPort(outport_);

    scalingModeProp_.addOption("scaleFixed", "Fixed Range [0:1]", HeightFieldScaling::FixedRange);
    scalingModeProp_.addOption("scaleRange", "Data Range", HeightFieldScaling::DataRange);
    scalingModeProp_.addOption("scaleSeaLevel", "Sea Level", HeightFieldScaling::SeaLevel);
    scalingModeProp_.set(HeightFieldScaling::FixedRange);
    scalingModeProp_.onChange(this, &HeightFieldMapper::scalingModeChanged);

    addProperty(scalingModeProp_);
    addProperty(heightRange_);
    addProperty(maxHeight_);
    addProperty(seaLevel_);

    setAllPropertiesCurrentStateAsDefault();

    // update UI state
    scalingModeChanged();
}
예제 #3
0
StreamLines::StreamLines()
    : Processor()
    , sampler_("sampler")
    , seedPoints_("seedpoints")
    , linesStripsMesh_("linesStripsMesh_")
    , streamLineProperties_("streamLineProperties", "Stream Line Properties")
    , tf_("transferFunction", "Transfer Function")
    , velocityScale_("velocityScale_", "Velocity Scale (inverse)", 1, 0, 10)
    , maxVelocity_("minMaxVelocity", "Velocity Range", "0", InvalidationLevel::Valid) {
    

    addPort(sampler_);
    addPort(seedPoints_);
    addPort(linesStripsMesh_);

    maxVelocity_.setReadOnly(true);

    addProperty(streamLineProperties_);

    addProperty(tf_);
    addProperty(velocityScale_);
    addProperty(maxVelocity_);

    tf_.get().clearPoints();
    tf_.get().addPoint(vec2(0, 1), vec4(0, 0, 1, 1));
    tf_.get().addPoint(vec2(0.5, 1), vec4(1, 1, 0, 1));
    tf_.get().addPoint(vec2(1, 1), vec4(1, 0, 0, 1));

    setAllPropertiesCurrentStateAsDefault();
}
예제 #4
0
VolumeLowPass::VolumeLowPass()
    : VolumeGLProcessor("volume_lowpass.frag")
    , kernelSize_("kernelSize", "Kernel size", 3, 2, 27)
    , useGaussianWeights_("useGaussianWeights", "Use Gaussian Weights")
    , sigma_("sigma", "Sigma", 1.f, 0.001f, 2.f, 0.001f) {
    addProperty(kernelSize_);
    addProperty(useGaussianWeights_);
    useGaussianWeights_.addProperty(sigma_);
    useGaussianWeights_.getBoolProperty()->setInvalidationLevel(InvalidationLevel::InvalidResources);

    setAllPropertiesCurrentStateAsDefault();
}
예제 #5
0
OrdinalPropertyAnimator::OrdinalPropertyAnimator()
    : Processor()
    , type_("property", "Property")
    , delay_("delay", "Delay (ms)", 50, 1, 10000, 1)
    , pbc_("pbc", "Periodic", true)
    , active_("active", "Active", false) 
    , timer_(delay_, [this](){timerEvent();})
{
    delay_.onChange(this, &OrdinalPropertyAnimator::updateTimerInterval);

    properties_.push_back(new PrimProp<float>("org.inviwo.FloatProperty", "org.inviwo.FloatProperty"));
    properties_.push_back(new VecProp<vec2>("org.inviwo.FloatVec2Property", "org.inviwo.FloatVec2Property"));
    properties_.push_back(new VecProp<vec3>("org.inviwo.FloatVec3Property", "org.inviwo.FloatVec3Property"));
    properties_.push_back(new VecProp<vec4>("org.inviwo.FloatVec4Property", "org.inviwo.FloatVec4Property"));
    properties_.push_back(new PrimProp<double>("org.inviwo.DoubleProperty","org.inviwo.DoubleProperty"));
    properties_.push_back(new VecProp<dvec2>("org.inviwo.DoubleVec2Property", "org.inviwo.DoubleVec2Property"));
    properties_.push_back(new VecProp<dvec3>("org.inviwo.DoubleVec3Property", "org.inviwo.DoubleVec3Property"));
    properties_.push_back(new VecProp<dvec4>("org.inviwo.DoubleVec4Property", "org.inviwo.DoubleVec4Property"));
    properties_.push_back(new PrimProp<int>("org.inviwo.IntProperty", "org.inviwo.IntProperty"));
    properties_.push_back(new VecProp<ivec2>("org.inviwo.IntVec2Property", "org.inviwo.IntVec2Property"));
    properties_.push_back(new VecProp<ivec3>("org.inviwo.IntVec3Property", "org.inviwo.IntVec3Property"));
    properties_.push_back(new VecProp<ivec4>("org.inviwo.IntVec4Property", "org.inviwo.IntVec4Property"));

    addProperty(type_);
    addProperty(active_);
    addProperty(delay_);
    addProperty(pbc_);

    int count = 0;
    for (auto p : properties_) {
        type_.addOption(p->classname_, p->displayName_, count);
        Property* prop = p->getProp();
        Property* delta = p->getDelta();

        addProperty(prop);
        addProperty(delta);
        prop->setVisible(false);
        delta->setVisible(false);
        count++;
    }
    type_.setSelectedIndex(0);
    type_.setCurrentStateAsDefault();
    
    type_.onChange(this, &OrdinalPropertyAnimator::changeProperty);
    active_.onChange(this, &OrdinalPropertyAnimator::changeActive);

    changeProperty();

    setAllPropertiesCurrentStateAsDefault();
}
예제 #6
0
PlaneProperty::PlaneProperty(const PlaneProperty& rhs)
    : CompositeProperty(rhs)
    , enable_(rhs.enable_)
    , mode_(rhs.mode_)
    , position_(rhs.position_)
    , normal_(rhs.normal_)
    , color_(rhs.color_) {

    addProperty(enable_);
    addProperty(mode_);
    addProperty(position_);
    addProperty(normal_);
    addProperty(color_);

    mode_.onChange(this, &PlaneProperty::onModeChange);
    setAllPropertiesCurrentStateAsDefault();
}
예제 #7
0
PlaneProperty::PlaneProperty(std::string identifier, std::string displayName,
                             InvalidationLevel invalidationLevel, PropertySemantics semantics)
    : CompositeProperty(identifier, displayName, invalidationLevel, semantics)
    , enable_("enable", "Enable", true, InvalidationLevel::InvalidResources)
    , mode_("mode", "Mode", InvalidationLevel::InvalidResources)
    , position_("position", "Position", vec3(0.5f), vec3(0.0f), vec3(1.0f))
    , normal_("normal", "Normal", vec3(0.0f, 0.0f, 1.0f), vec3(-1.0f), vec3(1.0f))
    , color_("color", "Color", vec4(1.0f, 1.0f, 1.0f, 1.0f), vec4(0.0f), vec4(1.0f), vec4(0.01f),
             InvalidationLevel::InvalidOutput, PropertySemantics::Color) {
    addProperty(enable_);
    addProperty(mode_);
    addProperty(position_);
    addProperty(normal_);
    addProperty(color_);

    mode_.onChange(this, &PlaneProperty::onModeChange);
    mode_.addOption("plane", "Plane", 0);

    setAllPropertiesCurrentStateAsDefault();
}
예제 #8
0
CanvasProcessor::CanvasProcessor()
    : Processor()
    , inport_("inport")
    , dimensions_("dimensions", "Canvas Size", ivec2(256, 256), ivec2(128, 128), ivec2(4096, 4096),
                  ivec2(1, 1), VALID)
    , enableCustomInputDimensions_("enableCustomInputDimensions", "Separate Image Size", false,
                                   VALID)
    , customInputDimensions_("customInputDimensions", "Image Size", ivec2(256, 256),
                             ivec2(128, 128), ivec2(4096, 4096), ivec2(1, 1), VALID)
    , keepAspectRatio_("keepAspectRatio", "Lock Aspect Ratio", true, VALID)
    , aspectRatioScaling_("aspectRatioScaling", "Image Scale", 1.f, 0.1f, 4.f, 0.01f, VALID)
    , visibleLayer_("visibleLayer", "Visible Layer")
    , colorLayer_("colorLayer_", "Color Layer ID", 0, 0, 0)
    , saveLayerDirectory_("layerDir", "Output Directory", "", "image")
    , saveLayerButton_("saveLayer", "Save Image Layer", VALID)
    , inputSize_("inputSize", "Input Dimension Parameters")
    , previousImageSize_(customInputDimensions_)
    , evaluator_(nullptr)
    , canvasWidget_(nullptr)
    , queuedRequest_(false) {
    addPort(inport_);
    addProperty(inputSize_);

    dimensions_.onChange(this, &CanvasProcessor::resizeCanvas);
    inputSize_.addProperty(dimensions_);

    enableCustomInputDimensions_.onChange(this, &CanvasProcessor::sizeChanged);
    inputSize_.addProperty(enableCustomInputDimensions_);

    customInputDimensions_.onChange(this, &CanvasProcessor::sizeChanged);
    customInputDimensions_.setVisible(false);
    inputSize_.addProperty(customInputDimensions_);

    keepAspectRatio_.onChange(this, &CanvasProcessor::sizeChanged);
    keepAspectRatio_.setVisible(false);
    inputSize_.addProperty(keepAspectRatio_);

    aspectRatioScaling_.onChange(this, &CanvasProcessor::sizeChanged);
    aspectRatioScaling_.setVisible(false);
    inputSize_.addProperty(aspectRatioScaling_);

    visibleLayer_.addOption("color", "Color layer", LayerType::Color);
    visibleLayer_.addOption("depth", "Depth layer", LayerType::Depth);
    visibleLayer_.addOption("picking", "Picking layer", LayerType::Picking);
    visibleLayer_.set(LayerType::Color);
    addProperty(visibleLayer_);
    addProperty(colorLayer_);
    addProperty(saveLayerDirectory_);

    saveLayerButton_.onChange(this, &CanvasProcessor::saveImageLayer);
    addProperty(saveLayerButton_);

    colorLayer_.setSerializationMode(PropertySerializationMode::ALL);

    visibleLayer_.onChange([&](){
        if (inport_.hasData()){
            auto layers = inport_.getData()->getNumberOfColorLayers();
            colorLayer_.setVisible(layers > 1 && visibleLayer_.get() == LayerType::Color);
        }
        colorLayer_.setVisible(visibleLayer_.get() == LayerType::Color);
    });

    inport_.onChange([&](){
        int layers = static_cast<int>(inport_.getData()->getNumberOfColorLayers());
        colorLayer_.setVisible(layers > 1 && visibleLayer_.get() == LayerType::Color);
        colorLayer_.setMaxValue(layers - 1);
    });


    setAllPropertiesCurrentStateAsDefault();
}
예제 #9
0
CanvasProcessor::CanvasProcessor()
    : Processor()
    , inport_("inport")
    , dimensions_("dimensions", "Canvas Size", ivec2(256, 256), ivec2(128, 128), ivec2(4096, 4096),
                  ivec2(1, 1), InvalidationLevel::Valid)
    , enableCustomInputDimensions_("enableCustomInputDimensions", "Separate Image Size", false,
                                   InvalidationLevel::Valid)
    , customInputDimensions_("customInputDimensions", "Image Size", ivec2(256, 256),
                             ivec2(128, 128), ivec2(4096, 4096), ivec2(1, 1),
                             InvalidationLevel::Valid)
    , keepAspectRatio_("keepAspectRatio", "Lock Aspect Ratio", true, InvalidationLevel::Valid)
    , aspectRatioScaling_("aspectRatioScaling", "Image Scale", 1.f, 0.1f, 4.f, 0.01f,
                          InvalidationLevel::Valid)
    , visibleLayer_("visibleLayer", "Visible Layer")
    , colorLayer_("colorLayer_", "Color Layer ID", 0, 0, 0)
    , saveLayerDirectory_("layerDir", "Output Directory", "", "image")
    , saveLayerButton_("saveLayer", "Save Image Layer", InvalidationLevel::Valid)
    , inputSize_("inputSize", "Input Dimension Parameters")
    , toggleFullscreen_("toggleFullscreen", "Toggle Full Screen")
    , fullscreen_("fullscreen", "FullScreen",
                  [this](Event* event) { setFullScreen(!isFullScreen()); }, IvwKey::F,
                  KeyState::Press, KeyModifier::Shift)
    , previousImageSize_(customInputDimensions_)
    , widgetMetaData_{createMetaData<ProcessorWidgetMetaData>(
          ProcessorWidgetMetaData::CLASS_IDENTIFIER)}
    , canvasWidget_(nullptr)
    , queuedRequest_(false) {
    widgetMetaData_->addObserver(this);
    
    addPort(inport_);
    addProperty(inputSize_);
    
    dimensions_.setSerializationMode(PropertySerializationMode::None);
    dimensions_.onChange([this](){widgetMetaData_->setDimensions(dimensions_.get());});
    inputSize_.addProperty(dimensions_);

    enableCustomInputDimensions_.onChange(this, &CanvasProcessor::sizeChanged);
    inputSize_.addProperty(enableCustomInputDimensions_);

    customInputDimensions_.onChange(this, &CanvasProcessor::sizeChanged);
    customInputDimensions_.setVisible(false);
    inputSize_.addProperty(customInputDimensions_);

    keepAspectRatio_.onChange(this, &CanvasProcessor::sizeChanged);
    keepAspectRatio_.setVisible(false);
    inputSize_.addProperty(keepAspectRatio_);

    aspectRatioScaling_.onChange(this, &CanvasProcessor::sizeChanged);
    aspectRatioScaling_.setVisible(false);
    inputSize_.addProperty(aspectRatioScaling_);

    visibleLayer_.addOption("color", "Color layer", LayerType::Color);
    visibleLayer_.addOption("depth", "Depth layer", LayerType::Depth);
    visibleLayer_.addOption("picking", "Picking layer", LayerType::Picking);
    visibleLayer_.set(LayerType::Color);
    addProperty(visibleLayer_);
    addProperty(colorLayer_);
    addProperty(saveLayerDirectory_);

    saveLayerButton_.onChange(this, &CanvasProcessor::saveImageLayer);
    addProperty(saveLayerButton_);

    colorLayer_.setSerializationMode(PropertySerializationMode::All);
    colorLayer_.setVisible(false);

    visibleLayer_.onChange([&]() {
        if (inport_.hasData()) {
            auto layers = inport_.getData()->getNumberOfColorLayers();
            colorLayer_.setVisible(layers > 1 && visibleLayer_.get() == LayerType::Color);
        }
    });

    toggleFullscreen_.onChange([this]() { setFullScreen(!isFullScreen()); });

    addProperty(toggleFullscreen_);
    addProperty(fullscreen_);

    inport_.onChange([&]() {
        int layers = static_cast<int>(inport_.getData()->getNumberOfColorLayers());
        colorLayer_.setVisible(layers > 1 && visibleLayer_.get() == LayerType::Color);
        colorLayer_.setMaxValue(layers - 1);
    });

    inport_.onConnect([&](){
       sizeChanged();
    });

    setAllPropertiesCurrentStateAsDefault();
}
예제 #10
0
AxisAlignedCutPlane::AxisAlignedCutPlane()
    : Processor()
    , volume_("volume")
    , imageInport_("imageInport_")
    , outport_("outport")
    , xSlide_("x", "X Slide")
    , ySlide_("y", "Y Slide")
    , zSlide_("z", "Z Slide")
    , disableTF_("disableTF", "Disable transfer function", false,
                 InvalidationLevel::InvalidResources)
    , tf_("transferfunction", "Transfer function", TransferFunction(), &volume_)
    , sliceShader_("geometryrendering.vert", "axisalignedcutplaneslice.frag", false)
    , boundingBoxShader_("geometryrendering.vert", "axisalignedcutplaneboundingbox.frag")
    , showBoundingBox_("boundingBox", "Show Bounding Box", true)
    , boundingBoxColor_("boundingBoxColor", "Bounding Box Color", vec4(0.0f, 0.0f, 0.0f, 1.0f))
	, renderPointSize_("renderPointSize", "Point Size", 1.0f, 0.001f, 15.0f, 0.001f)
	, renderLineWidth_("renderLineWidth", "Line Width", 1.0f, 0.001f, 15.0f, 0.001f)
    , nearestInterpolation_("nearestInterpolation", "Use nearest neighbor interpolation", false)
    , camera_("camera", "Camera")
    , trackball_(&camera_) {
    addPort(volume_);
    addPort(imageInport_);
    addPort(outport_);

    addProperty(xSlide_);
    addProperty(ySlide_);
    addProperty(zSlide_);
    addProperty(disableTF_);
    addProperty(tf_);
    addProperty(showBoundingBox_);
	addProperty(boundingBoxColor_);
	addProperty(renderPointSize_);
	addProperty(renderLineWidth_);

    addProperty(camera_);
    addProperty(trackball_);

    imageInport_.setOptional(true);

    tf_.get().clearPoints();
    tf_.get().addPoint(vec2(0.0f, 1.0f), vec4(0.0f, 0.0f, 0.0f, 1.0f));
    tf_.get().addPoint(vec2(1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f));

    tf_.setCurrentStateAsDefault();

    xSlide_.onChange([&]() {
        if (volume_.hasData()) xSlide_.createDrawer(volume_.getData());
    });
    ySlide_.onChange([&]() {
        if (volume_.hasData()) ySlide_.createDrawer(volume_.getData());
    });
    zSlide_.onChange([&]() {
        if (volume_.hasData()) zSlide_.createDrawer(volume_.getData());
    });

    volume_.onChange([&]() {
        if (!volume_.hasData()) return;
        auto vol = volume_.getData();
        xSlide_.onVolumeChange(vol);
        ySlide_.onVolumeChange(vol);
        zSlide_.onVolumeChange(vol);
        if (!boundingBoxMesh_) {
            createBoundingBox();
        }
        boundingBoxMesh_->setModelMatrix(vol->getModelMatrix());
        boundingBoxMesh_->setWorldMatrix(vol->getWorldMatrix());
    });

    boundingBoxColor_.setSemantics(PropertySemantics::Color);

    setAllPropertiesCurrentStateAsDefault();

    createBoundingBox();

}
예제 #11
0
MeshRenderProcessorGLSR::MeshRenderProcessorGLSR()
	: Processor()
	, inport_("geometryInport")
	//, imageInport_("imageInport")
	, meshName_("meshName")
	, outport_("imageOutport") //,DataFormatBase::get(DataFormatId::UInt16))
	//, declarationsOutport_("declarationsOutport")
	, sceneDescOutport_("sceneDescriptionOutport")
	, camera_("camera", "Camera")
	, centerViewOnGeometry_("centerView", "Center view on geometry")
	, setNearFarPlane_("setNearFarPlane", "Calculate Near and Far Plane")
	, resetViewParams_("resetView", "Reset Camera")
	, trackball_(&camera_)
	, overrideColorBuffer_("overrideColorBuffer", "Override Color Buffer", false,
		InvalidationLevel::InvalidResources)
	, overrideColor_("overrideColor", "Override Color", vec4(0.75f, 0.75f, 0.75f, 1.0f), vec4(0.0f),
		vec4(1.0f))
	, geomProperties_("geometry", "Geometry Rendering Properties")
	, cullFace_("cullFace", "Cull Face")
	, polygonMode_("polygonMode", "Polygon Mode")
	, renderPointSize_("renderPointSize", "Point Size", 1.0f, 0.001f, 15.0f, 0.001f)
	, renderLineWidth_("renderLineWidth", "Line Width", 1.0f, 0.001f, 15.0f, 0.001f)
	, enableDepthTest_("enableDepthTest_", "Enable Depth Test", true)
	, lightingProperty_("lighting", "Lighting", &camera_)
	, layers_("layers", "Layers (max 8)")
	, fragcolorLayer_("fragcolorLayer", "Frag Color", true, InvalidationLevel::InvalidResources)
	, cameraDirLayer_("cameraDirLayer", "Camera Direction", false,
		InvalidationLevel::InvalidResources)
	, normalsLayer_("normalsLayer", "Normals (World Space)", false,
		InvalidationLevel::InvalidResources)
	, lightDirLayer_("lightDirLayer", "Light Direction", false, InvalidationLevel::InvalidResources)
	, thresholdLayer_("thresholdLayer", "Silhouette Threshold", false, InvalidationLevel::InvalidResources)
    , thresholdDepthLayer_("thresholdDepthLayer", "Depth Threshold", false, InvalidationLevel::InvalidResources)
	, materialColLayer_("materialColor", "Material Specular Color", false, InvalidationLevel::InvalidResources)
	, lightSpecColLayer_("lightSpecularColor", "Light Specular Color", false, InvalidationLevel::InvalidResources)
	, shininessLayer_("shininess", "Specular Shininess Factor", false, InvalidationLevel::InvalidResources)
	, debugval1Layer_("debugval1Layer", "Debug Val 1", false, InvalidationLevel::InvalidResources)
	, debugval2Layer_("debugval2Layer", "Debug Val 2", false, InvalidationLevel::InvalidResources)

//	, colorLayer_("colorLayer", "Color", true, InvalidationLevel::InvalidResources)
//	, texCoordLayer_("texCoordLayer", "Texture Coordinates", false,
//		InvalidationLevel::InvalidResources)
//  , viewNormalsLayer_("viewNormalsLayer", "View Normals", false,
//                       InvalidationLevel::InvalidResources)
//	, worldPosLayer_("worldPosLayer", "World Position Coordinates", false,
//		InvalidationLevel::InvalidResources)
//  , unnormalizedNormalsLayer_("notnormalizedNormalsLayer", "Normals (not normalised)", false,
//			InvalidationLevel::InvalidResources)
//	, fragDepthLayer_("fragDepthLayer", "Frag Depth", false,
//		InvalidationLevel::InvalidResources)
//  , viewNormalsNotLayer_("viewNormalsNotLayer", "View Normals (nor normalised)", false,
//			    InvalidationLevel::InvalidResources)
//	, lightColorLayer_("lightColorLayer", "Light Color", false, InvalidationLevel::InvalidResources)

    //, layerDec_(std::make_shared<Declarations>()) 
	, sceneDesc_(std::make_shared<SceneDescription>())
    , shader_("silhouette.vert", "silhouette.frag", false) 
    {
    addPort(inport_);
    //addPort(imageInport_);
	addPort(meshName_);
    addPort(outport_);
    //addPort(declarationsOutport_);
	addPort(sceneDescOutport_);
	//declarationsOutport_.setData(layerDec_);
	sceneDescOutport_.setData(sceneDesc_);

   // imageInport_.setOptional(true);

	addProperty(lightingProperty_);

	addProperty(layers_);
	layers_.addProperty(fragcolorLayer_);
	layers_.addProperty(normalsLayer_);	
	layers_.addProperty(cameraDirLayer_);
	layers_.addProperty(lightDirLayer_);
	layers_.addProperty(thresholdLayer_);
    layers_.addProperty(thresholdDepthLayer_);
	layers_.addProperty(materialColLayer_);
	layers_.addProperty(lightSpecColLayer_);
	layers_.addProperty(shininessLayer_);
	//layers_.addProperty(colorLayer_);
	//layers_.addProperty(texCoordLayer_);
	//layers_.addProperty(viewNormalsLayer_);
	//layers_.addProperty(worldPosLayer_);
	//layers_.addProperty(unnormalizedNormalsLayer_);
	//layers_.addProperty(fragDepthLayer_);
	//layers_.addProperty(viewNormalsNotLayer_);
	//layers_.addProperty(lightColorLayer_);
	layers_.addProperty(debugval1Layer_);
	layers_.addProperty(debugval2Layer_);


    addProperty(camera_);
    centerViewOnGeometry_.onChange(this, &MeshRenderProcessorGLSR::centerViewOnGeometry);
    addProperty(centerViewOnGeometry_);
    setNearFarPlane_.onChange(this, &MeshRenderProcessorGLSR::setNearFarPlane);
    addProperty(setNearFarPlane_);
    resetViewParams_.onChange([this]() { camera_.resetCamera(); });
    addProperty(resetViewParams_);
    outport_.addResizeEventListener(&camera_);
    inport_.onChange(this, &MeshRenderProcessorGLSR::updateDrawers);
	//meshName_.onChange(this, &MeshRenderProcessorGLSR::setSceneDesc);
	LogInfo(outport_.getData()->getDataFormat()->getString());

    cullFace_.addOption("culldisable", "Disable", GL_NONE);
    cullFace_.addOption("cullfront", "Front", GL_FRONT);
    cullFace_.addOption("cullback", "Back", GL_BACK);
    cullFace_.addOption("cullfrontback", "Front & Back", GL_FRONT_AND_BACK);
    cullFace_.set(GL_NONE);

    polygonMode_.addOption("polypoint", "Points", GL_POINT);
    polygonMode_.addOption("polyline", "Lines", GL_LINE);
    polygonMode_.addOption("polyfill", "Fill", GL_FILL);
    polygonMode_.set(GL_FILL);
    polygonMode_.onChange(this, &MeshRenderProcessorGLSR::changeRenderMode);

    geomProperties_.addProperty(cullFace_);
    geomProperties_.addProperty(polygonMode_);
    geomProperties_.addProperty(renderPointSize_);
    geomProperties_.addProperty(renderLineWidth_);
    geomProperties_.addProperty(enableDepthTest_);

    geomProperties_.addProperty(overrideColorBuffer_);
    geomProperties_.addProperty(overrideColor_);
    overrideColor_.setSemantics(PropertySemantics::Color);
    overrideColor_.setVisible(false);
    overrideColorBuffer_.onChange([&]() { overrideColor_.setVisible(overrideColorBuffer_.get()); });

    float lineWidthRange[2];
    float increment;
    glGetFloatv(GL_LINE_WIDTH_RANGE, lineWidthRange);
    glGetFloatv(GL_LINE_WIDTH_GRANULARITY, &increment);
    renderLineWidth_.setMinValue(lineWidthRange[0]);
    renderLineWidth_.setMaxValue(lineWidthRange[1]);
    renderLineWidth_.setIncrement(increment);

    renderLineWidth_.setVisible(false);
    renderPointSize_.setVisible(false);

    addProperty(geomProperties_);
    addProperty(trackball_);



    setAllPropertiesCurrentStateAsDefault();
}
예제 #12
0
MeshRenderProcessorGL::MeshRenderProcessorGL()
    : Processor()
    , inport_("geometry.inport")
    , imageInport_("imageInport")
    , outport_("image.outport")
    , camera_("camera", "Camera")
    , centerViewOnGeometry_("centerView", "Center view on geometry")
    , setNearFarPlane_("setNearFarPlane", "Calculate Near and Far Plane")
    , resetViewParams_("resetView", "Reset Camera")
    , trackball_(&camera_)
    , overrideColorBuffer_("overrideColorBuffer", "Override Color Buffer", false , INVALID_RESOURCES)
    , overrideColor_("overrideColor", "Override Color", vec4(0.75f, 0.75f, 0.75f, 1.0f), vec4(0.0f), vec4(1.0f))
    , geomProperties_("geometry", "Geometry Rendering Properties")
    , cullFace_("cullFace", "Cull Face")
    , polygonMode_("polygonMode", "Polygon Mode")
    , renderPointSize_("renderPointSize", "Point Size", 1.0f, 0.001f, 15.0f, 0.001f)
    , renderLineWidth_("renderLineWidth", "Line Width", 1.0f, 0.001f, 15.0f, 0.001f)
    , lightingProperty_("lighting", "Lighting", &camera_)
    , layers_("layers", "Layers")
    , colorLayer_("colorLayer", "Color", true, INVALID_RESOURCES)
    , texCoordLayer_("texCoordLayer", "Texture Coordinates", false, INVALID_RESOURCES)
    , normalsLayer_("normalsLayer", "Normals (World Space)", false, INVALID_RESOURCES)
    , viewNormalsLayer_("viewNormalsLayer", "Normals (View space)", false, INVALID_RESOURCES)
    , shader_("geometryrendering.vert", "geometryrendering.frag", false) {

    addPort(inport_);
    addPort(imageInport_);
    addPort(outport_);
    addProperty(camera_);
    centerViewOnGeometry_.onChange(this, &MeshRenderProcessorGL::centerViewOnGeometry);
    addProperty(centerViewOnGeometry_);
    setNearFarPlane_.onChange(this, &MeshRenderProcessorGL::setNearFarPlane);
    addProperty(setNearFarPlane_);
    resetViewParams_.onChange([this]() { camera_.resetCamera(); });    addProperty(resetViewParams_);
    outport_.addResizeEventListener(&camera_);
    inport_.onChange(this, &MeshRenderProcessorGL::updateDrawers);

    cullFace_.addOption("culldisable", "Disable", GL_NONE);
    cullFace_.addOption("cullfront", "Front", GL_FRONT);
    cullFace_.addOption("cullback", "Back", GL_BACK);
    cullFace_.addOption("cullfrontback", "Front & Back", GL_FRONT_AND_BACK);
    cullFace_.set(GL_NONE);

    polygonMode_.addOption("polypoint", "Points", GL_POINT);
    polygonMode_.addOption("polyline", "Lines", GL_LINE);
    polygonMode_.addOption("polyfill", "Fill", GL_FILL);
    polygonMode_.set(GL_FILL);
    polygonMode_.onChange(this, &MeshRenderProcessorGL::changeRenderMode);

    geomProperties_.addProperty(cullFace_);
    geomProperties_.addProperty(polygonMode_);
    geomProperties_.addProperty(renderPointSize_);
    geomProperties_.addProperty(renderLineWidth_);

    geomProperties_.addProperty(overrideColorBuffer_);
    geomProperties_.addProperty(overrideColor_);
    overrideColor_.setSemantics(PropertySemantics::Color);
    overrideColor_.setVisible(false);
    overrideColorBuffer_.onChange([&](){overrideColor_.setVisible(overrideColorBuffer_.get()); });

    float lineWidthRange[2];
    float increment;
    glGetFloatv(GL_LINE_WIDTH_RANGE, lineWidthRange);
    glGetFloatv(GL_LINE_WIDTH_GRANULARITY, &increment);
    renderLineWidth_.setMinValue(lineWidthRange[0]);
    renderLineWidth_.setMaxValue(lineWidthRange[1]);
    renderLineWidth_.setIncrement(increment);

    renderLineWidth_.setVisible(false);
    renderPointSize_.setVisible(false);

    addProperty(geomProperties_);
    addProperty(lightingProperty_);
    addProperty(trackball_);

    addProperty(layers_);
    layers_.addProperty(colorLayer_);
    layers_.addProperty(texCoordLayer_);
    layers_.addProperty(normalsLayer_);
    layers_.addProperty(viewNormalsLayer_);

    setAllPropertiesCurrentStateAsDefault();
}