RtVoid Subdivide(RtPointer data, RtFloat detail) { RtFloat *curve_width = (RtFloat *)data; RtInt nverts[1] = {2}; RtFloat plist[6]={0.0,0.0,0.0,0.0,1.0,0.0}; RtFloat wlist[2]={*curve_width, 0.0}; RiDeclare("width","[varying] [float] []"); /* output a curve with the given width */ RiCurves ( (RtToken)"linear", 1, nverts, (RtToken)"periodic", (RtToken)"P", plist, (RtToken)"width", wlist); }
void SpotLight::prepare(Scene* scene) { #if 0 /* Attribute castShadows = attributeByName("Casts Shadows"); if (castShadows && castShadows->property("value").isValid()) { } */ //Attribute position = ; //position.property("value").toFloat(); QVector3D position = getBoundValue<QVector3D>(this, attributeByName("Position")); QVector3D lookat = position + lookDir(); float coneAngle = PI * attributeByName("Cone Angle")->property("value").value<float>() / 180.0f; RtFloat intensity = attributeByName("Intensity")->property("value").value<float>(); RtPoint from = { position.x(), position.y(), position.z() }; RtPoint to = { lookat.x(), lookat.y(), lookat.z() }; QColor color = attributeByName("Color")->property("value").value<QColor>(); RtColor c = { color.redF(), color.greenF(), color.blueF() }; bool castsShadow = attributeByName("Casts Shadows")->property("value").value<bool>(); if (castsShadow) { QString shadowPath = QString(getenv("AQSIS_TEXTURE_PATH")).split(":")[0] + "/" + scene->assetName(this) + ".shd"; char cShadowPath[1000]; strcpy(cShadowPath, shadowPath.toStdString().c_str()); char *shadowPaths[]= { cShadowPath, RI_NULL }; // float shadowBias = attributeByName("Shadow Bias")->property("value").value<float>(); //RiOption("shadow", "bias", (RtPointer)&shadowBias, RI_NULL); // std::cout << "shadow bias: " << shadowBias << std::endl; RiDeclare("shadowname", "uniform string"); RiLightSource("shadowspot", "from", from, "to", to, "intensity", &intensity, "coneangle", &coneAngle, "lightcolor", &c, "shadowname", shadowPaths, RI_NULL); } else RiLightSource("spotlight", "from", from, "to", to, "intensity", &intensity, "coneangle", &coneAngle, "lightcolor", &c, RI_NULL); //LightSource "shadowspot" 1 "intensity" 50 "from" [1 5 0] "to" [0 0 0] // "shadowname" ["spot1.tx"] #endif }