OSPPickResult Renderer::pick(const vec2f &screenPos) { assert(getIE()); OSPPickResult res; ispc::Renderer_pick(getIE(), (const ispc::vec2f&)screenPos, (ispc::vec3f&)res.position, res.hit); return res; }
void AO16Material::commit() { Kd = getParam3f("color", getParam3f("kd", getParam3f("Kd", vec3f(.8f)))); map_Kd = (Texture2D*)getParamObject("map_Kd", getParamObject("map_kd", NULL)); ispc::AO16Material_set(getIE(), (const ispc::vec3f&)Kd, map_Kd.ptr!=NULL?map_Kd->getIE():NULL); }
void SciVisRenderer::commit() { Renderer::commit(); lightData = (Data*)getParamData("lights"); lightArray.clear(); if (lightData) { for (int i = 0; i < lightData->size(); i++) lightArray.push_back(((Light**)lightData->data)[i]->getIE()); } void **lightPtr = lightArray.empty() ? NULL : &lightArray[0]; const bool shadowsEnabled = getParam1i("shadowsEnabled", 0); const int32 maxDepth = getParam1i("maxDepth", 10); int numAOSamples = getParam1i("aoSamples", 0); float rayLength = getParam1f("aoOcclusionDistance", 1e20f); float aoWeight = getParam1f("aoWeight", 0.25f); ispc::SciVisRenderer_set(getIE(), shadowsEnabled, maxDepth, numAOSamples, rayLength, aoWeight, lightPtr, lightArray.size()); }
void BasicRenderer::commit() { AbstractRenderer::commit(); ispc::BasicRenderer_set(getIE(), (_bgMaterial ? _bgMaterial->getIE() : nullptr), _timestamp, spp, _lightPtr, _lightArray.size()); }
void StreamLines::finalize(Model *model) { radius = getParam1f("radius",0.01f); vertexData = getParamData("vertex",NULL); indexData = getParamData("index",NULL); colorData = getParamData("vertex.color",getParamData("color")); Assert(radius > 0.f); Assert(vertexData); Assert(indexData); index = (const uint32*)indexData->data; numSegments = indexData->numItems; vertex = (const vec3fa*)vertexData->data; numVertices = vertexData->numItems; color = colorData ? (const vec4f*)colorData->data : NULL; std::cout << "#osp: creating streamlines geometry, " << "#verts=" << numVertices << ", " << "#segments=" << numSegments << ", " << "radius=" << radius << std::endl; ispc::StreamLineGeometry_set(getIE(),model->getIE(),radius, (ispc::vec3fa*)vertex,numVertices, (uint32_t*)index,numSegments, (ispc::vec4f*)color); }
void SpotLight::commit() { Light::commit(); position = getParam3f("position", vec3f(0.f)); direction = getParam3f("direction", vec3f(0.f, 0.f, 1.f)); color = getParam3f("color", vec3f(1.f)); intensity = getParam1f("intensity", 1.f); openingAngle = getParam1f("openingAngle", 2.0f * getParam1f("halfAngle"/*deprecated*/, 90.f)); penumbraAngle = getParam1f("penumbraAngle", 5.f); radius = getParam1f("radius", 0.f); // check ranges and pre-compute parameters vec3f power = color * intensity; direction = normalize(direction); openingAngle = clamp(openingAngle, 0.f, 180.f); penumbraAngle = clamp(penumbraAngle, 0.f, 0.5f*openingAngle); const float cosAngleMax = ospcommon::cos(deg2rad(0.5f*openingAngle)); const float cosAngleMin = ospcommon::cos(deg2rad(0.5f*openingAngle - penumbraAngle)); const float cosAngleScale = 1.0f/(cosAngleMin - cosAngleMax); ispc::SpotLight_set(getIE(), (ispc::vec3f&)position, (ispc::vec3f&)direction, (ispc::vec3f&)power, cosAngleMax, cosAngleScale, radius); }
void PerspectiveCamera::commit() { // ------------------------------------------------------------------ // first, "parse" the expected parameters // ------------------------------------------------------------------ pos = getParam3f("pos",vec3fa(0.f)); dir = getParam3f("dir",vec3fa(0.f,0.0f,1.f)); up = getParam3f("up", vec3fa(0.f,1.0f,0.f)); near = getParamf("near",0.f); far = getParamf("far", std::numeric_limits<float>::infinity()); fovy = getParamf("fovy",60.f); aspect = getParamf("aspect",1.f); // ------------------------------------------------------------------ // now, update the local precomptued values // ------------------------------------------------------------------ vec3f dz = normalize(dir); vec3f dx = normalize(cross(dz,up)); vec3f dy = normalize(cross(dx,dz)); float imgPlane_size_y = 2.f*sinf(fovy/2.f*M_PI/180.); float imgPlane_size_x = imgPlane_size_y * aspect; dir_00 = dz - (.5f * imgPlane_size_x) * dx - (.5f * imgPlane_size_y) * dy; dir_du = dx * imgPlane_size_x; dir_dv = dy * imgPlane_size_y; ispc::PerspectiveCamera_set(getIE(), (const ispc::vec3f&)pos, (const ispc::vec3f&)dir_00, (const ispc::vec3f&)dir_du, (const ispc::vec3f&)dir_dv); }
void SciVisMaterial::commit() { map_d = (Texture2D*)getParamObject("map_d", nullptr); map_Kd = (Texture2D*)getParamObject("map_Kd", getParamObject("map_kd", nullptr)); map_Ks = (Texture2D*)getParamObject("map_Ks", getParamObject("map_ks", nullptr)); map_Ns = (Texture2D*)getParamObject("map_Ns", getParamObject("map_ns", nullptr)); map_Bump = (Texture2D*)getParamObject("map_Bump", getParamObject("map_bump",nullptr)); d = getParam1f("d", 1.f); Kd = getParam3f("kd", getParam3f("Kd", vec3f(.8f))); Ks = getParam3f("ks", getParam3f("Ks", vec3f(0.f))); Ns = getParam1f("ns", getParam1f("Ns", 10.f)); volume = (Volume *)getParamObject("volume", nullptr); ispc::SciVisMaterial_set(getIE(), map_d ? map_d->getIE() : nullptr, d, map_Kd ? map_Kd->getIE() : nullptr, (ispc::vec3f&)Kd, map_Ks ? map_Ks->getIE() : nullptr, (ispc::vec3f&)Ks, map_Ns ? map_Ns->getIE() : nullptr, Ns, map_Bump != nullptr ? map_Bump->getIE():nullptr, volume ? volume->getIE() : nullptr); }
//! \brief commit the material's parameters void OBJMaterial::commit() { if (ispcEquivalent == NULL) ispcEquivalent = ispc::OBJMaterial_create(this); map_d = (Texture2D*)getParamObject("map_d", NULL); map_Kd = (Texture2D*)getParamObject("map_Kd", getParamObject("map_kd", NULL)); map_Ks = (Texture2D*)getParamObject("map_Ks", getParamObject("map_ks", NULL)); map_Ns = (Texture2D*)getParamObject("map_Ns", getParamObject("map_ns", NULL)); map_Bump = (Texture2D*)getParamObject("map_Bump", getParamObject("map_bump", NULL)); d = getParam1f("d", 1.f); Kd = getParam3f("kd", getParam3f("Kd", vec3f(.8f))); Ks = getParam3f("ks", getParam3f("Ks", vec3f(0.f))); Ns = getParam1f("ns", getParam1f("Ns", 10.f)); ispc::OBJMaterial_set(getIE(), map_d ? map_d->getIE() : NULL, d, map_Kd ? map_Kd->getIE() : NULL, (ispc::vec3f&)Kd, map_Ks ? map_Ks->getIE() : NULL, (ispc::vec3f&)Ks, map_Ns ? map_Ns->getIE() : NULL, Ns, map_Bump != NULL ? map_Bump->getIE() : NULL ); }
Model::~Model() { if (embreeSceneHandle) rtcReleaseScene(embreeSceneHandle); ispc::Model_cleanup(getIE()); }
//! \brief commit the material's parameters virtual void commit() override { if (getIE() == nullptr) { ispcEquivalent = ispc::PathTracer_Glass_create(); } const float etaInside = getParamf("etaInside", getParamf("eta", 1.5f)); const float etaOutside = getParamf("etaOutside", 1.f); const vec3f& attenuationColorInside = getParam3f("attenuationColorInside", getParam3f("attenuationColor", getParam3f("color", vec3f(1.f)))); const vec3f& attenuationColorOutside = getParam3f("attenuationColorOutside", vec3f(1.f)); const float attenuationDistance = getParamf("attenuationDistance", getParamf("distance", 1.0f)); ispc::PathTracer_Glass_set( ispcEquivalent, etaInside, (const ispc::vec3f&)attenuationColorInside, etaOutside, (const ispc::vec3f&)attenuationColorOutside, attenuationDistance); }
//! \brief commit the material's parameters virtual void commit() override { const vec3f& color = getParam3f("color", vec3f(0.9f)); Texture2D *map_color = (Texture2D*)getParamObject("map_color"); affine2f xform_color = getTextureTransform("map_color"); const vec3f& edgeColor = getParam3f("edgeColor", vec3f(1.f)); Texture2D *map_edgeColor = (Texture2D*)getParamObject("map_edgeColor"); affine2f xform_edgeColor = getTextureTransform("map_edgeColor"); const float roughness = getParamf("roughness", 0.1f); Texture2D *map_roughness = (Texture2D*)getParamObject("map_roughness"); affine2f xform_roughness = getTextureTransform("map_roughness"); ispc::PathTracer_Alloy_set(getIE() , (const ispc::vec3f&)color , map_color ? map_color->getIE() : nullptr , (const ispc::AffineSpace2f&)xform_color , (const ispc::vec3f&)edgeColor , map_edgeColor ? map_edgeColor->getIE() : nullptr , (const ispc::AffineSpace2f&)xform_edgeColor , roughness , map_roughness ? map_roughness->getIE() : nullptr , (const ispc::AffineSpace2f&)xform_roughness ); }
void Camera::commit() { // "parse" the general expected parameters pos = getParam3f("pos", vec3f(0.f)); dir = getParam3f("dir", vec3f(0.f, 0.f, 1.f)); up = getParam3f("up", vec3f(0.f, 1.f, 0.f)); nearClip = getParam1f("nearClip", getParam1f("near_clip", 1e-6f)); imageStart = getParam2f("imageStart", getParam2f("image_start", vec2f(0.f))); imageEnd = getParam2f("imageEnd", getParam2f("image_end", vec2f(1.f))); shutterOpen = getParam1f("shutterOpen", 0.0f); shutterClose = getParam1f("shutterClose", 0.0f); linear3f frame; frame.vz = -normalize(dir); frame.vx = normalize(cross(up, frame.vz)); frame.vy = cross(frame.vz, frame.vx); ispc::Camera_set(getIE() , (const ispc::vec3f&)pos , (const ispc::LinearSpace3f&)frame , nearClip , (const ispc::vec2f&)imageStart , (const ispc::vec2f&)imageEnd , shutterOpen , shutterClose ); }
void ExtendedCylinders::finalize(ospray::Model *model) { radius = getParam1f("radius",0.01f); materialID = getParam1i("materialID",0); bytesPerCylinder = getParam1i("bytes_per_cylinder",9*sizeof(float)); offset_v0 = getParam1i("offset_v0",0); offset_v1 = getParam1i("offset_v1",3*sizeof(float)); offset_radius = getParam1i("offset_radius",6*sizeof(float)); offset_timestamp = getParam1i("offset_timestamp",7*sizeof(float)); offset_value = getParam1i("offset_value",8*sizeof(float)); offset_materialID = getParam1i("offset_materialID",-1); data = getParamData("extendedcylinders",nullptr); if (data.ptr == nullptr || bytesPerCylinder == 0) throw std::runtime_error("#ospray:geometry/extendedcylinders: " \ "no 'extendedcylinders' data specified"); numExtendedCylinders = data->numBytes / bytesPerCylinder; ispc::ExtendedCylindersGeometry_set( getIE(), model->getIE(), data->data, numExtendedCylinders, bytesPerCylinder, radius, materialID, offset_v0, offset_v1, offset_radius, offset_timestamp, offset_value, offset_materialID); }
void RaycastVolumeRenderer::Material::commit() { Kd = getParam3f("color", getParam3f("kd", getParam3f("Kd", vec3f(1.0f)))); volume = (Volume *)getParamObject("volume", NULL); ispc::RaycastVolumeRendererMaterial_set(getIE(), (const ispc::vec3f&)Kd, volume ? volume->getIE() : NULL); }
void Model::commit() { useEmbreeDynamicSceneFlag = getParam<int>("dynamicScene", 0); useEmbreeCompactSceneFlag = getParam<int>("compactMode", 0); useEmbreeRobustSceneFlag = getParam<int>("robustMode", 0); postStatusMsg(2) << "=======================================================\n" << "Finalizing model, has " << geometry.size() << " geometries and " << volume.size() << " volumes"; RTCDevice embreeDevice = (RTCDevice)ospray_getEmbreeDevice(); int sceneFlags = 0; sceneFlags = sceneFlags | (useEmbreeDynamicSceneFlag ? RTC_SCENE_FLAG_DYNAMIC : 0); sceneFlags = sceneFlags | (useEmbreeCompactSceneFlag ? RTC_SCENE_FLAG_COMPACT : 0); sceneFlags = sceneFlags | (useEmbreeRobustSceneFlag ? RTC_SCENE_FLAG_ROBUST : 0); ispc::Model_init(getIE(), embreeDevice, sceneFlags, geometry.size(), volume.size()); embreeSceneHandle = (RTCScene)ispc::Model_getEmbreeSceneHandle(getIE()); bounds = empty; for (size_t i = 0; i < geometry.size(); i++) { postStatusMsg(2) << "=======================================================\n" << "Finalizing geometry " << i; geometry[i]->finalize(this); bounds.extend(geometry[i]->bounds); ispc::Model_setGeometry(getIE(), i, geometry[i]->getIE()); } for (size_t i=0; i<volume.size(); i++) ispc::Model_setVolume(getIE(), i, volume[i]->getIE()); rtcCommitScene(embreeSceneHandle); }
void SimulationRenderer::commit( ) { Renderer::commit(); lightData = ( ospray::Data* )getParamData( "lights" ); lightArray.clear( ); if( lightData ) for( size_t i=0; i < lightData->size( ); ++i ) lightArray.push_back( ( ( ospray::Light** )lightData->data )[ i ]->getIE( )); void **lightPtr = lightArray.empty() ? nullptr : &lightArray[0]; ospray::vec3f bgColor = getParam3f( "bgColor", ospray::vec3f( 1.f )); shadowsEnabled = bool( getParam1i( "shadowsEnabled", 1 )); softShadowsEnabled = bool(getParam1i( "softShadowsEnabled", 1 )); ambientOcclusionStrength = getParam1f( "ambientOcclusionStrength", 0.f ); shadingEnabled = bool( getParam1i( "shadingEnabled", 1 )); randomNumber = getParam1i( "randomNumber", 0 ); moving = bool( getParam1i( "moving", 0 )); timestamp = getParam1f( "timestamp", 0.f ); spp = getParam1i("spp", 1); electronShadingEnabled = bool( getParam1i( "electronShading", 0 )); ospray::vec3f scale = getParam3f( "scale", ospray::vec3f( 1.f )); simulationNbOffsets = getParam1i( "simulationNbOffsets", 0 ); simulationNbFrames = getParam1i( "simulationNbFrames", 0 ); // Those materials are used for simulation mapping only materialData = ( ospray::Data* )getParamData( "materials" ); materialArray.clear( ); if( materialData ) for( size_t i = 0; i < materialData->size( ); ++i ) materialArray.push_back( ( ( ospray::Material** )materialData->data )[i]->getIE( )); void **materialPtr = materialArray.empty( ) ? nullptr : &materialArray[0]; ispc::SimulationRenderer_set( getIE( ), ( ispc::vec3f& )bgColor, ( ispc::vec3f& )scale, shadowsEnabled, softShadowsEnabled, ambientOcclusionStrength, shadingEnabled, randomNumber, moving, timestamp, spp, electronShadingEnabled, simulationNbOffsets, simulationNbFrames, lightPtr, lightArray.size( ), materialPtr, materialArray.size( )); }
//! \brief commit the material's parameters virtual void commit() override { const vec3f pigmentColor = getParam3f("pigmentColor",vec3f(1.f)); const float eta = getParamf("eta",1.4f); const float roughness = getParamf("roughness",0.01f); ispc::PathTracer_Plastic_set (getIE(), (const ispc::vec3f&)pigmentColor,eta,roughness); }
void Renderer::commit() { autoEpsilon = getParam1i("autoEpsilon", true); epsilon = getParam1f("epsilon", 1e-6f); spp = std::max(1, getParam1i("spp", 1)); const int32 maxDepth = getParam1i("maxDepth", 20); const float minContribution = getParam1f("minContribution", 0.001f); errorThreshold = getParam1f("varianceThreshold", 0.f); maxDepthTexture = (Texture2D*)getParamObject("maxDepthTexture", nullptr); model = (Model*)getParamObject("model", getParamObject("world")); if (maxDepthTexture) { if (maxDepthTexture->type != OSP_TEXTURE_R32F || !(maxDepthTexture->flags & OSP_TEXTURE_FILTER_NEAREST)) { static WarnOnce warning("maxDepthTexture provided to the renderer " "needs to be of type OSP_TEXTURE_R32F and have " "the OSP_TEXTURE_FILTER_NEAREST flag"); } } vec3f bgColor3 = getParam3f("bgColor", vec3f(getParam1f("bgColor", 0.f))); bgColor = getParam4f("bgColor", vec4f(bgColor3, 0.f)); if (getIE()) { ManagedObject* camera = getParamObject("camera"); if (model) { const float diameter = model->bounds.empty() ? 1.0f : length(model->bounds.size()); epsilon *= diameter; } ispc::Renderer_set(getIE() , model ? model->getIE() : nullptr , camera ? camera->getIE() : nullptr , autoEpsilon , epsilon , spp , maxDepth , minContribution , (ispc::vec4f&)bgColor , maxDepthTexture ? maxDepthTexture->getIE() : nullptr ); } }
void AmbientLight::commit() { Light::commit(); color = getParam3f("color", vec3f(1.f)); intensity = getParam1f("intensity", 1.f); vec3f radiance = getRadiance(); ispc::AmbientLight_set(getIE(), (ispc::vec3f&)radiance); }
void SimulationMaterial::commit() { if (ispcEquivalent == nullptr) ispcEquivalent = ispc::SimulationMaterial_create(this); DefaultMaterial::commit(); const bool withSimulationOffsets = getParam1i("apply_simulation", 0) == 1; ispc::SimulationMaterial_set(getIE(), withSimulationOffsets); }
//! Commit parameters understood by the PointLight void PointLight::commit() { position = getParam3f("position", vec3f(0.f)); color = getParam3f("color", vec3f(1.f)); intensity = getParam1f("intensity", 1.f); radius = getParam1f("radius", 0.f); vec3f power = color * intensity; ispc::PointLight_set(getIE(), (ispc::vec3f&)position, (ispc::vec3f&)power, radius); }
//! \brief commit the material's parameters virtual void commit() { if (getIE() != NULL) return; const vec3f pigmentColor = getParam3f("pigmentColor",vec3f(1.f)); const float eta = getParamf("eta",1.4f); const float roughness = getParamf("roughness",0.01f); // const float rcpRoughness = rcpf(roughness); ispcEquivalent = ispc::PathTracer_Plastic_create ((const ispc::vec3f&)pigmentColor,eta,roughness); }
void LocalFrameBuffer::setTile(Tile &tile) { if (pixelOp) pixelOp->preAccum(tile); if (accumBuffer) { const float err = ispc::LocalFrameBuffer_accumulateTile(getIE(),(ispc::Tile&)tile); if ((tile.accumID & 1) == 1) tileErrorRegion.update(tile.region.lower/TILE_SIZE, err); } if (hasAlbedoBuffer) ispc::LocalFrameBuffer_accumulateAuxTile(getIE(),(ispc::Tile&)tile, (ispc::vec3f*)albedoBuffer, tile.ar, tile.ag, tile.ab); if (hasNormalBuffer) ispc::LocalFrameBuffer_accumulateAuxTile(getIE(),(ispc::Tile&)tile, (ispc::vec3f*)normalBuffer, tile.nx, tile.ny, tile.nz); if (pixelOp) pixelOp->postAccum(tile); if (colorBuffer) { switch (colorBufferFormat) { case OSP_FB_RGBA8: ispc::LocalFrameBuffer_writeTile_RGBA8(getIE(),(ispc::Tile&)tile); break; case OSP_FB_SRGBA: ispc::LocalFrameBuffer_writeTile_SRGBA(getIE(),(ispc::Tile&)tile); break; case OSP_FB_RGBA32F: ispc::LocalFrameBuffer_writeTile_RGBA32F(getIE(),(ispc::Tile&)tile); break; default: NOTIMPLEMENTED; } } }
void Slices::finalize(Model *model) { planesData = getParamData("planes", NULL); volume = (Volume *)getParamObject("volume", NULL); Assert(planesData); Assert(volume); numPlanes = planesData->numItems; planes = (const vec4f*)planesData->data; ispc::Slices_set(getIE(), model->getIE(), numPlanes, (ispc::vec4f*)planes, volume->getIE()); }
void AO16Renderer<NUM_SAMPLES_PER_FRAME>::commit() { Renderer::commit(); model = (Model *)getParamObject("world",NULL); // old naming model = (Model *)getParamObject("model",model); // new naming camera = (Camera *)getParamObject("camera",NULL); bgColor = getParam3f("bgColor",vec3f(1.f)); ispc::AO16Renderer_set(getIE(), NUM_SAMPLES_PER_FRAME, (const ispc::vec3f&)bgColor, model?model->getIE():NULL, camera?camera->getIE():NULL); }
//! Commit parameters understood by the DirectionalLight void DirectionalLight::commit() { direction = getParam3f("direction", vec3f(0.f, 0.f, 1.f)); color = getParam3f("color", vec3f(1.f)); intensity = getParam1f("intensity", 1.f); angularDiameter = getParam1f("angularDiameter", .0f); const vec3f radiance = color * intensity; direction = -normalize(direction); // the ispc::DirLight expects direction towards light source angularDiameter = clamp(angularDiameter, 0.f, 180.f); const float cosAngle = cos(deg2rad(0.5f*angularDiameter)); ispc::DirectionalLight_set(getIE(), (ispc::vec3f&)direction, (ispc::vec3f&)radiance, cosAngle); }
void LocalFrameBuffer::setTile(Tile &tile) { if (pixelOp) pixelOp->preAccum(tile); if (accumBuffer) ispc::LocalFrameBuffer_accumulateTile(getIE(),(ispc::Tile&)tile); if (pixelOp) pixelOp->postAccum(tile); if (colorBuffer) { switch (colorBufferFormat) { case OSP_FB_RGBA8: ispc::LocalFrameBuffer_writeTile_RGBA8(getIE(),(ispc::Tile&)tile); break; case OSP_FB_SRGBA: ispc::LocalFrameBuffer_writeTile_SRGBA(getIE(),(ispc::Tile&)tile); break; case OSP_FB_RGBA32F: ispc::LocalFrameBuffer_writeTile_RGBA32F(getIE(),(ispc::Tile&)tile); break; default: NOTIMPLEMENTED; } } }
void ProximityRenderer::commit( ) { Renderer::commit( ); lightData = ( ospray::Data* )getParamData( "lights" ); lightArray.clear( ); if( lightData ) for( size_t i = 0; i < lightData->size( ); ++i ) lightArray.push_back(((Light**)lightData->data)[i]->getIE()); void **lightPtr = lightArray.empty( ) ? NULL : &lightArray[0]; vec3f bgColor = getParam3f( "bgColor", vec3f( 0.f )); vec3f nearColor = getParam3f( "detectionNearColor", vec3f( 0.f, 1.f, 0.f )); vec3f farColor = getParam3f( "detectionFarColor", vec3f( 1.f, 0.f, 0.f )); detectionDistance = getParam1f( "detectionDistance", 1.f ); detectionOnDifferentMaterial = bool( getParam1i( "detectionOnDifferentMaterial", 0 )); randomNumber = getParam1i( "randomNumber", 0 ); timestamp = getParam1f( "timestamp", 0.f ); spp = getParam1i( "spp", 1 ); electronShadingEnabled = bool( getParam1i( "electronShading", 1 )); // Those materials are used for skybox mapping only materialData = ( ospray::Data* )getParamData( "materials" ); materialArray.clear( ); if( materialData ) for( size_t i = 0; i < materialData->size( ); ++i ) materialArray.push_back( ( ( ospray::Material** )materialData->data )[i]->getIE( )); void **materialArrayPtr = materialArray.empty( ) ? nullptr : &materialArray[0]; ispc::ProximityRenderer_set( getIE( ), ( ispc::vec3f& )bgColor, ( ispc::vec3f& )nearColor, ( ispc::vec3f& )farColor, detectionDistance, detectionOnDifferentMaterial, randomNumber, timestamp, spp, electronShadingEnabled, lightPtr, lightArray.size( ), materialArrayPtr, materialArray.size( )); }
void SciVisRenderer::commit() { Renderer::commit(); lightData = (Data*)getParamData("lights"); lightArray.clear(); vec3f aoColor = vec3f(0.f); bool ambientLights = false; if (lightData) { for (uint32_t i = 0; i < lightData->size(); i++) { const Light* const light = ((Light**)lightData->data)[i]; // extract color from ambient lights and remove them const AmbientLight* const ambient = dynamic_cast<const AmbientLight*>(light); if (ambient) { ambientLights = true; aoColor += ambient->getRadiance(); } else lightArray.push_back(light->getIE()); } } void **lightPtr = lightArray.empty() ? nullptr : &lightArray[0]; const bool shadowsEnabled = getParam1i("shadowsEnabled", 0); int aoSamples = getParam1i("aoSamples", 0); float aoDistance = getParam1f("aoDistance", getParam1f("aoOcclusionDistance"/*old name*/, 1e20f)); // "aoWeight" is deprecated, use an ambient light instead if (!ambientLights) aoColor = vec3f(getParam1f("aoWeight", 0.f)); const bool aoTransparencyEnabled = getParam1i("aoTransparencyEnabled", 0); const bool oneSidedLighting = getParam1i("oneSidedLighting", 1); ispc::SciVisRenderer_set(getIE(), shadowsEnabled, aoSamples, aoDistance, (ispc::vec3f&)aoColor, aoTransparencyEnabled, lightPtr, lightArray.size(), oneSidedLighting); }