SpotLightSourceProcessor::SpotLightSourceProcessor() : Processor() , outport_("SpotLightSource") , camera_("camera", "Camera", vec3(0.0f, 0.0f, -2.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 1.0f, 0.0f), nullptr, InvalidationLevel::Valid) , lightPosition_("lightPosition", "Light Source Position", FloatVec3Property("position", "Position", vec3(100.f), vec3(-100.f), vec3(100.f)), &camera_) , lighting_("lighting", "Light Parameters") , lightPowerProp_("lightPower", "Light power (%)", 50.f, 0.f, 100.f) , lightSize_("lightSize", "Light size", vec2(1.5f, 1.5f), vec2(0.0f, 0.0f), vec2(3.0f, 3.0f)) , lightDiffuse_("lightDiffuse", "Color", vec3(1.0f)) , lightConeRadiusAngle_("lightConeRadiusAngle", "Light Cone Radius Angle", 30.f, 1.f, 90.f) , lightFallOffAngle_("lightFallOffAngle", "Light Fall Off Angle", 5.f, 0.f, 30.f) , lightSource_{std::make_shared<SpotLight>()} { addPort(outport_); addProperty(lightPosition_); lighting_.addProperty(lightConeRadiusAngle_); lighting_.addProperty(lightFallOffAngle_); lighting_.addProperty(lightDiffuse_); lighting_.addProperty(lightPowerProp_); lighting_.addProperty(lightSize_); addProperty(lighting_); addProperty(camera_); lightDiffuse_.setSemantics(PropertySemantics::Color); lightDiffuse_.setCurrentStateAsDefault(); }
PointLightSourceProcessor::PointLightSourceProcessor() : Processor() , outport_("PointLightSource") , camera_("camera", "Camera", vec3(0.0f, 0.0f, -2.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 1.0f, 0.0f), nullptr, VALID) , lightPosition_("lightPosition", "Light Source Position", FloatVec3Property("position", "Position", vec3(-2.f, -50.f, 90.f), vec3(-100.f), vec3(100.f)), &camera_.get()) , lighting_("lighting", "Light Parameters") , lightPowerProp_("lightPower", "Light power (%)", 50.f, 0.f, 100.f) , lightSize_("lightSize", "Light radius", 1.5f, 0.0f, 3.0f) , lightDiffuse_("lightDiffuse", "Color", vec4(1.0f)) , lightEnabled_("lightEnabled", "Enabled", true) , lightScreenPosEnabled_("lightScreenPosEnabled", "Screen Pos Enabled", false) , lightScreenPos_("lightScreenPos", "Light Screen Pos", vec2(0.7f), vec2(0.f), vec2(1.f)) , interactionEvents_("interactionEvents", "Interaction Events") , lightInteractionHandler_(&lightPosition_.position_, &camera_, &lightScreenPosEnabled_, &lightScreenPos_) , lightSource_(std::make_shared<PointLight>()) { addPort(outport_); addProperty(lightPosition_); lighting_.addProperty(lightDiffuse_); lighting_.addProperty(lightPowerProp_); lighting_.addProperty(lightSize_); lighting_.addProperty(lightEnabled_); lighting_.addProperty(lightScreenPosEnabled_); lighting_.addProperty(lightScreenPos_); addProperty(lighting_); lightScreenPos_.setVisible(false); lightScreenPosEnabled_.onChange( [this]() { lightScreenPos_.setVisible(lightScreenPosEnabled_.get()); }); addProperty(camera_); camera_.setVisible(false); lightDiffuse_.setSemantics(PropertySemantics::Color); lightDiffuse_.setCurrentStateAsDefault(); lightScreenPos_.onChange( [this]() { lightInteractionHandler_.setLightPosFromScreenCoords(lightScreenPos_.get()); }); interactionEvents_.addOption("off", "Handle None", 0); interactionEvents_.addOption("on", "Handle All", 1); interactionEvents_.addOption("onlytrackball", "Handle Trackball Related Only", 2); interactionEvents_.addOption("onlyscreencorrds", "Handle Light Pos From Screen Coords Only", 3); interactionEvents_.setSelectedValue(0); interactionEvents_.setCurrentStateAsDefault(); addProperty(interactionEvents_); interactionEvents_.onChange(this, &PointLightSourceProcessor::handleInteractionEventsChanged); }