/*public*/ LightIcon::LightIcon(Editor* editor, QObject *parent) : PositionableIcon(new NamedIcon("resources/icons/smallschematics/tracksegments/os-lefthand-east-closed.gif", "resources/icons/smallschematics/tracksegments/os-lefthand-east-closed.gif"), editor, (Positionable*)this) { // super ctor call to make sure this is an icon label //super(new NamedIcon("resources/icons/smallschematics/tracksegments/os-lefthand-east-closed.gif", // "resources/icons/smallschematics/tracksegments/os-lefthand-east-closed.gif"), editor); log = new Logger("LightIcon"); log->setDebugEnabled(true); _control = true; light = NULL; _bVisible = true; _icon = true; setPopupUtility(NULL); offLName = "resources/icons/smallschematics/tracksegments/os-lefthand-east-closed.gif"; off = new NamedIcon(offLName, offLName); onLName = "resources/icons/smallschematics/tracksegments/os-lefthand-east-thrown.gif"; on = new NamedIcon(onLName, onLName); inconsistentLName = "resources/icons/smallschematics/tracksegments/os-lefthand-east-error.gif"; inconsistent = new NamedIcon(inconsistentLName, inconsistentLName); unknownLName = "resources/icons/smallschematics/tracksegments/os-lefthand-east-unknown.gif"; unknown = new NamedIcon(unknownLName, unknownLName); _namedIcon = unknown; _editor = editor; _icon = true; displayState(lightState()); }
void restoreLightState(int *ls) { int i; ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv; for (i=0; i<7; i++) { if (ls[i] != p->lightOnOff[i]) { lightState(i,ls[i]); } } }
void initializeLightTables() { int i; float pos[] = { 0.0f, 0.0f, 1.0f, 0.0f }; float dif[] = { 1.0f, 1.0f, 1.0f, 1.0f }; float shin[] = { 0.6f, 0.6f, 0.6f, 1.0f }; float As[] = { 0.0f, 0.0f, 0.0f, 1.0f }; ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv; PRINT_GL_ERROR_IF_ANY("start of initializeightTables"); for(i=0; i<8; i++) { p->lightOnOff[i] = 9999; lightState(i,FALSE); FW_GL_LIGHTFV(i, GL_POSITION, pos); FW_GL_LIGHTFV(i, GL_AMBIENT, As); FW_GL_LIGHTFV(i, GL_DIFFUSE, dif); FW_GL_LIGHTFV(i, GL_SPECULAR, shin); FW_GL_LIGHTF(i, GL_CONSTANT_ATTENUATION,1.0f); FW_GL_LIGHTF(i, GL_LINEAR_ATTENUATION,0.0f); FW_GL_LIGHTF(i, GL_QUADRATIC_ATTENUATION,0.0f); FW_GL_LIGHTF(i, GL_SPOT_CUTOFF,180.0f); FW_GL_LIGHTF(i, GL_SPOT_EXPONENT,0.0f); PRINT_GL_ERROR_IF_ANY("initizlizeLight2"); } lightState(HEADLIGHT_LIGHT, TRUE); #ifndef GL_ES_VERSION_2_0 FW_GL_LIGHTMODELI(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); FW_GL_LIGHTMODELI(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); FW_GL_LIGHTMODELI(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE); FW_GL_LIGHTMODELI(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); FW_GL_LIGHTMODELFV(GL_LIGHT_MODEL_AMBIENT,As); #else //printf ("skipping light setups\n"); #endif LIGHTING_INITIALIZE PRINT_GL_ERROR_IF_ANY("end initializeLightTables"); }
QVariant BuildingModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.row() < 0 || index.row() >= rowCount()) return QVariant(); auto room = _rooms.at(index.row()); switch (role) { case IdRole: return room->id(); case NameRole: return room->name(); case LightStateRole: return room->lightState()==LightState::On ? 1 : 0; case RoomStateRole: return room->roomState()==RoomState::Ok ? 1 : 0; default: return QVariant(); } }