void PointLight::PreDraw(X3DDrawContext* pDC) { if (!getGlobal() && getOn()) { SetLight(pDC); } }
void CX3DDirectionalLightNode::print(int indent) { FILE *fp = CX3DParser::getDebugLogFp(); char *nodeName = getNodeName(); if (nodeName) { float r, g, b; float x, y, z; CX3DParser::printIndent(indent); fprintf(fp, "%s (%s)\n", nodeName, CX3DNode::getNodeTypeString(getNodeType())); CX3DParser::printIndent(indent+1); fprintf(fp, "ambientIntensity : (%f)\n", getAmbientIntensity()->getValue()); getColor()->getValue(r, g, b); CX3DParser::printIndent(indent+1); fprintf(fp, "color : (%f %f %f)\n", r, g, b); getDirection()->getValue(x, y, z); CX3DParser::printIndent(indent+1); fprintf(fp, "direction : (%f %f %f)\n", x, y, z); CX3DParser::printIndent(indent+1); fprintf(fp, "intensity : (%f)\n", getIntensity()->getValue()); CX3DParser::printIndent(indent+1); fprintf(fp, "on : %s\n", getOn()->getValue() ? "TRUE" : "FALSE"); CX3DParser::printIndent(indent+1); fprintf(fp, "global : %s\n", getGlobal()->getValue() ? "TRUE" : "FALSE"); } }
void PointLight::DrawGlobalLights(X3DDrawContext* pDC) { if (getGlobal() && getOn()) { SetLight(pDC); } }
Action::ResultE DirectionalLight::renderLeave(Action *action) { if(getOn() == false) return Action::Continue; return Light::renderLeave(action); }
Action::ResultE PointLight::drawLeave(Action *action) { if(getOn() == false) return Action::Continue; return Light::drawLeave(action); }
Action::ResultE SpotLight::renderLeave(Action *action) { if(getOn() == false) return Action::Continue; return PointLightBase::renderLeave(action); }
Action::ResultE DirectionalLight::renderEnter(Action *action) { if(getOn() == false) return Action::Continue; DrawActionBase *da = dynamic_cast<DrawActionBase *>(action); da->getStatistics()->getElem(DirectionalLight::statNDirectionalLights)->inc(); return Light::renderEnter(action); }
Action::ResultE SpotLight::renderEnter(Action *action) { if(getOn() == false) return Action::Continue; DrawActionBase *da = dynamic_cast<DrawActionBase *>(action); if(da->getStatCollector() != NULL) { da->getStatCollector()->getElem(SpotLight::statNSpotLights)->inc(); } return PointLight::renderEnter(action); }
Action::ResultE PointLight::drawEnter(Action *action) { if(getOn() == false) return Action::Continue; DrawAction *da = dynamic_cast<DrawAction *>(action); GLenum light = GL_LIGHT0 + da->getLightCount(); Light::drawEnter(action); Vec4f pos(_sfPosition.getValue()); pos[3] = 1; glLightfv(light, GL_POSITION , pos.getValues()); glLightf (light, GL_SPOT_CUTOFF, 180.f ); glPopMatrix(); da->getStatistics()->getElem(PointLight::statNPointLights)->inc(); return Action::Continue; }
Vector getDiffuse(ItemPtr item, Vector point) { if(item->type==CHECKER && !getOn((VectorAccess)point)) { return ZERO; } return item->surface.diffuse; }