int fSettings::appendValue(QVariant fValue, QString array, QString key, int unique) { if((!unique)||(findValue(fValue,array,key)==-1)) { int size=beginReadArray(array); endArray(); beginWriteArray(array); setArrayIndex(size); setValue(key, fValue); endArray(); return 1; } else return 0; }
void LightFlareData::initPersistFields() { addGroup( "LightFlareData" ); addField( "overallScale", TypeF32, Offset( mScale, LightFlareData ) ); addField( "occlusionRadius", TypeF32, Offset( mOcclusionRadius, LightFlareData ), "Radius in world units to test for occlusion if supported by hardware, disable by setting radius non-positive." ); endGroup( "LightFlareData" ); addGroup( "FlareElements" ); addField( "flareEnabled", TypeBool, Offset( mFlareEnabled, LightFlareData ) ); addField( "flareTexture", TypeImageFilename, Offset( mFlareTextureName, LightFlareData ) ); addArray( "Elements", MAX_ELEMENTS ); addField( "elementRect", TypeRectF, Offset( mElementRect, LightFlareData ), MAX_ELEMENTS ); addField( "elementDist", TypeF32, Offset( mElementDist, LightFlareData ), MAX_ELEMENTS ); addField( "elementScale", TypeF32, Offset( mElementScale, LightFlareData ), MAX_ELEMENTS ); addField( "elementTint", TypeColorF, Offset( mElementTint, LightFlareData ), MAX_ELEMENTS ); addField( "elementRotate", TypeBool, Offset( mElementRotate, LightFlareData ), MAX_ELEMENTS ); addField( "elementUseLightColor", TypeBool, Offset( mElementUseLightColor, LightFlareData ), MAX_ELEMENTS ); endArray( "FlareElements" ); endGroup( "Flares" ); Parent::initPersistFields(); }
bool Reader::array() { if ( match('[') ) { space(); if ( value() ) { space(); if ( match(',') ) { space(); while ( value() ) { space(); if ( match(',') ) { space(); continue; } break; } } } if ( endArray() ) { return true; } throw __LINE__; // bad syntax } return false; }
void LegendWidget::drawVector(PlotCurve *c, QPainter *p, int x, int y, int l) { if (!c) return; VectorCurve *v = (VectorCurve*)c; p->save(); if (d_plot->antialiasing()) p->setRenderHints(QPainter::Antialiasing); QPen pen(v->color(), v->width(), Qt::SolidLine); p->setPen(pen); p->drawLine(x, y, x + l, y); p->translate(x + l, y); double pi=4*atan(-1.0); int headLength = v->headLength(); int d=qRound(headLength*tan(pi*(double)v->headAngle()/180.0)); QPolygon endArray(3); endArray[0] = QPoint(0, 0); endArray[1] = QPoint(-headLength, d); endArray[2] = QPoint(-headLength, -d); if (v->filledArrowHead()) p->setBrush(QBrush(pen.color(), Qt::SolidPattern)); p->drawPolygon(endArray); p->restore(); }
void BasicClouds::initPersistFields() { addGroup( "BasicClouds" ); addArray( "Layers", TEX_COUNT ); addField( "layerEnabled", TypeBool, Offset( mLayerEnabled, BasicClouds ), TEX_COUNT, "Enable or disable rendering of this layer." ); addField( "texture", TypeImageFilename, Offset( mTexName, BasicClouds ), TEX_COUNT, "Texture for this layer." ); addField( "texScale", TypeF32, Offset( mTexScale, BasicClouds ), TEX_COUNT, "Texture repeat for this layer." ); addField( "texDirection", TypePoint2F, Offset( mTexDirection, BasicClouds ), TEX_COUNT, "Texture scroll direction for this layer, relative to the world axis." ); addField( "texSpeed", TypeF32, Offset( mTexSpeed, BasicClouds ), TEX_COUNT, "Texture scroll speed for this layer." ); addField( "texOffset", TypePoint2F, Offset( mTexOffset, BasicClouds ), TEX_COUNT, "UV offset for this layer." ); addField( "height", TypeF32, Offset( mHeight, BasicClouds ), TEX_COUNT, "Abstract number which controls the curvature and height of the dome mesh" ); endArray( "Layers" ); endGroup( "BasicClouds" ); Parent::initPersistFields(); }
void LegendMarker::drawVector(QPainter *p, int x, int y, int l, int curveIndex) const { Graph *g = (Graph *)d_plot->parent(); if (!g) return; VectorCurve *v = (VectorCurve*)g->curve(curveIndex); if (!v) return; p->save(); QPen pen(v->color(), v->width(), Qt::SolidLine); p->setPen(pen); QwtPainter::drawLine(p, x, y, x + l, y); p->translate(x+l, y); double pi=4*atan(-1.0); int headLength = v->headLength(); int d=qRound(headLength*tan(pi*(double)v->headAngle()/180.0)); QPolygon endArray(3); endArray[0] = QPoint(0, 0); endArray[1] = QPoint(-headLength, d); endArray[2] = QPoint(-headLength, -d); if (v->filledArrowHead()) p->setBrush(QBrush(pen.color(), Qt::SolidPattern)); QwtPainter::drawPolygon(p,endArray); p->restore(); }
QVariant fSettings::lastItem(QString array, QString key) { int size=beginReadArray(array); setArrayIndex(size-1); QVariant val=value(key); endArray(); return val; }
void LightFlareData::initPersistFields() { addGroup( "LightFlareData" ); addField( "overallScale", TypeF32, Offset( mScale, LightFlareData ), "Size scale applied to all elements of the flare." ); addField( "losMask", TypeS32, Offset( mLOSMask, LightFlareData ), "Object type mask for LOS test." ); addField( "occlusionRadius", TypeF32, Offset( mOcclusionRadius, LightFlareData ), "If positive an occlusion query is used to test flare visibility, else it uses simple raycasts." ); addField( "renderReflectPass", TypeBool, Offset( mRenderReflectPass, LightFlareData ), "If false the flare does not render in reflections, else only non-zero distance elements are rendered." ); endGroup( "LightFlareData" ); addGroup( "FlareElements" ); addField( "flareEnabled", TypeBool, Offset( mFlareEnabled, LightFlareData ), "Allows the user to disable this flare globally for any lights referencing it." ); addField( "flareTexture", TypeImageFilename, Offset( mFlareTextureName, LightFlareData ), "The texture / sprite sheet for this flare." ); addArray( "Elements", MAX_ELEMENTS ); addField( "elementRect", TypeRectF, Offset( mElementRect, LightFlareData ), MAX_ELEMENTS, "A rectangle specified in pixels of the flareTexture image." ); addField( "elementDist", TypeF32, Offset( mElementDist, LightFlareData ), MAX_ELEMENTS, "Where this element appears along the flare beam." ); addField( "elementScale", TypeF32, Offset( mElementScale, LightFlareData ), MAX_ELEMENTS, "Size scale applied to this element." ); addField( "elementTint", TypeColorF, Offset( mElementTint, LightFlareData ), MAX_ELEMENTS, "Used to modulate this element's color if elementUseLightColor " "is false.\n" "@see elementUseLightColor" ); addField( "elementRotate", TypeBool, Offset( mElementRotate, LightFlareData ), MAX_ELEMENTS, "Defines if this element orients to point along the flare beam " "or if it is always upright." ); addField( "elementUseLightColor", TypeBool, Offset( mElementUseLightColor, LightFlareData ), MAX_ELEMENTS, "If true this element's color is modulated by the light color. " "If false, elementTint will be used.\n" "@see elementTint" ); endArray( "FlareElements" ); endGroup( "Flares" ); Parent::initPersistFields(); }
QStringList fSettings::toStringList(QString array, QString key) { int size=beginReadArray(array); QStringList uList; for(int i=0; i<size; i++) { setArrayIndex(i); uList.append(value(key).toString()); } endArray(); return uList; }
// Will exit the program if cannot parse ExcelValue parse(char **string) { while(true) { switch(**string) { case '"': return parseString(string); break; case '-': case '+': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return parseNumber(string); break; case 't': case 'f': return parseBoolean(string); break; case '#': return parseExcelError(string); break; case ' ': case '\t': case '\n': case '\r': case ',': // Important to progress through arrays (*string)++; break; case '[': return startArray(string); break; case ']': return endArray(string); break; case EOF: return parseFailed("Parse error - reached end of file", 0); break; case '\0': return parseFailed("Parse error - reached end of string", 0); break; default: return parseFailed("Parse error unrecognised character", *string); break; } } }
int fSettings::findValue(QVariant fValue, QString array, QString key) { // finds value in current array // Why does QSettings not have it? int size=beginReadArray(array); int ret=-1; for(int i=0; i<size; i++) { setArrayIndex(i); if(value(key)==fValue) ret=i; } endArray(); return ret; }
void Settings::load() { beginGroup("RecentProjects"); int size = beginReadArray("Project"); for (int i = 0; i < size; i++) { setArrayIndex(i); RecentProject proj; proj.path_ = value("Path").toString(); proj.name_ = value("Name").toString(); recentProjects_.append(proj); } endArray(); endGroup(); }
void Settings::store() { beginGroup("RecentProjects"); beginWriteArray("Project"); QLinkedList<RecentProject>::iterator itr; int i; for (itr = recentProjects_.begin(), i = 0; itr != recentProjects_.end(); ++itr, i++) { setArrayIndex(i); setValue("Path", (*itr).path_); setValue("Name", (*itr).name_); } endArray(); endGroup(); }
/** get configured values, with reasonable defaults */ Preferences::Preferences(QObject *parent) : QSettings("SWI-Prolog", "pqConsole", parent) { console_font = value("console_font", QFont("courier", 12)).value<QFont>(); wrapMode = static_cast<ConsoleEditBase::LineWrapMode>(value("wrapMode", ConsoleEditBase::WidgetWidth).toInt()); console_out_fore = value("console_out_fore", 0).toInt(); console_out_back = value("console_out_back", 7).toInt(); console_inp_fore = value("console_inp_fore", 0).toInt(); console_inp_back = value("console_inp_back", 15).toInt(); // selection from SVG named colors // see http://www.w3.org/TR/SVG/types.html#ColorKeywords static QColor v[] = { "black", "red", "green", "brown", "blue", "magenta", "cyan", "white", "gray", // 'highlighted' from here "magenta", "chartreuse", "gold", "dodgerblue", "magenta", "lightblue", "beige" }; ANSI_sequences.clear(); beginReadArray("ANSI_sequences"); for (int i = 0; i < 16; ++i) { setArrayIndex(i); QColor c = value("color", v[i]).value<QColor>(); if ( !c.isValid() ) // Play safe if the color is invalid c = v[i]; // Happens on MacOSX 10.11 (El Captain) ANSI_sequences.append(c); } endArray(); }
void VectorCurve::drawArrowHead(QPainter *p, int xs, int ys, int xe, int ye) const { p->save(); p->translate(xe, ye); double t=theta(xs, ys, xe, ye); p->rotate(-t); double pi=4*atan(-1.0); int d=qRound(d_headLength*tan(pi*(double)d_headAngle/180.0)); QPolygon endArray(3); endArray[0] = QPoint(0, 0); endArray[1] = QPoint(-d_headLength, d); endArray[2] = QPoint(-d_headLength, -d); if (filledArrow) p->setBrush(QBrush(pen.color(), Qt::SolidPattern)); QwtPainter::drawPolygon(p,endArray); p->restore(); }
void CloudLayer::initPersistFields() { addGroup( "CloudLayer" ); addField( "texture", TypeImageFilename, Offset( mTextureName, CloudLayer ), "An RGBA texture which should contain normals and opacity (density)." ); addArray( "Textures", TEX_COUNT ); addField( "texScale", TypeF32, Offset( mTexScale, CloudLayer ), TEX_COUNT, "Controls the texture repeat of this slot." ); addField( "texDirection", TypePoint2F, Offset( mTexDirection, CloudLayer ), TEX_COUNT, "Controls the direction this slot scrolls." ); addField( "texSpeed", TypeF32, Offset( mTexSpeed, CloudLayer ), TEX_COUNT, "Controls the speed this slot scrolls." ); endArray( "Textures" ); addField( "baseColor", TypeColorF, Offset( mBaseColor, CloudLayer ), "Base cloud color before lighting." ); addField( "exposure", TypeF32, Offset( mExposure, CloudLayer ), "Brightness scale so CloudLayer can be overblown if desired." ); addField( "coverage", TypeF32, Offset( mCoverage, CloudLayer ), "Fraction of sky covered by clouds 0-1." ); addField( "windSpeed", TypeF32, Offset( mWindSpeed, CloudLayer ), "Overall scalar to texture scroll speed." ); addField( "height", TypeF32, Offset( mHeight, CloudLayer ), "Abstract number which controls the curvature and height of the dome mesh." ); endGroup( "CloudLayer" ); Parent::initPersistFields(); }
/** save configured values */ Preferences::~Preferences() { #define SV(s) setValue(#s, s) SV(console_font); SV(wrapMode); SV(console_out_fore); SV(console_out_back); SV(console_inp_fore); SV(console_inp_back); #undef SV beginWriteArray("ANSI_sequences"); for (int i = 0; i < ANSI_sequences.size(); ++i) { setArrayIndex(i); setValue("color", ANSI_sequences[i]); } endArray(); }
TDV_NAMESPACE_BEGIN void CUDAProcess::process() { CUerrExp err; err << cudaSetDevice(m_deviceId); boost::scoped_array<bool> endArray(new bool[m_units.size()]); for (size_t i=0; i<m_units.size(); i++) endArray[i] = true; bool cont = true; while ( cont ) { cont = false; for (size_t i=0; i<m_units.size(); i++) { if ( endArray[i] ) endArray[i] = m_units[i]->update(); cont = cont || endArray[i]; } } }
void AITurretShapeData::initPersistFields() { addField("maxScanHeading", TypeF32, Offset(maxScanHeading, AITurretShapeData), "@brief Maximum number of degrees to scan left and right.\n\n" "@note Maximum scan heading is 90 degrees.\n"); addField("maxScanPitch", TypeF32, Offset(maxScanPitch, AITurretShapeData), "@brief Maximum number of degrees to scan up and down.\n\n" "@note Maximum scan pitch is 90 degrees.\n"); addField("maxScanDistance", TypeF32, Offset(maxScanDistance, AITurretShapeData), "@brief Maximum distance to scan.\n\n" "When combined with maxScanHeading and maxScanPitch this forms a 3D scanning wedge used to initially " "locate a target.\n"); addField("scanTickFrequency", TypeS32, Offset(scanTickFrequency, AITurretShapeData), "@brief How often should we perform a full scan when looking for a target.\n\n" "Expressed as the number of ticks between full scans, but no less than 1.\n"); addField("scanTickFrequencyVariance", TypeS32, Offset(scanTickFrequencyVariance, AITurretShapeData), "@brief Random amount that should be added to the scan tick frequency each scan period.\n\n" "Expressed as the number of ticks to randomly add, but no less than zero.\n"); addField("trackLostTargetTime", TypeF32, Offset(trackLostTargetTime, AITurretShapeData), "@brief How long after the turret has lost the target should it still track it.\n\n" "Expressed in seconds.\n"); addField("maxWeaponRange", TypeF32, Offset(maxWeaponRange, AITurretShapeData), "@brief Maximum distance that the weapon will fire upon a target.\n\n"); addField("weaponLeadVelocity", TypeF32, Offset(weaponLeadVelocity, AITurretShapeData), "@brief Velocity used to lead target.\n\n" "If value <= 0, don't lead target.\n"); // State arrays addArray( "States", MaxStates ); addField( "stateName", TypeCaseString, Offset(stateName, AITurretShapeData), MaxStates, "Name of this state." ); addField( "stateTransitionOnAtRest", TypeString, Offset(stateTransitionAtRest, AITurretShapeData), MaxStates, "Name of the state to transition to when the turret is at rest (static)."); addField( "stateTransitionOnNotAtRest", TypeString, Offset(stateTransitionNotAtRest, AITurretShapeData), MaxStates, "Name of the state to transition to when the turret is not at rest (not static)."); addField( "stateTransitionOnTarget", TypeString, Offset(stateTransitionTarget, AITurretShapeData), MaxStates, "Name of the state to transition to when the turret gains a target." ); addField( "stateTransitionOnNoTarget", TypeString, Offset(stateTransitionNoTarget, AITurretShapeData), MaxStates, "Name of the state to transition to when the turret loses a target." ); addField( "stateTransitionOnActivated", TypeString, Offset(stateTransitionActivated, AITurretShapeData), MaxStates, "Name of the state to transition to when the turret goes from deactivated to activated."); addField( "stateTransitionOnDeactivated", TypeString, Offset(stateTransitionDeactivated, AITurretShapeData), MaxStates, "Name of the state to transition to when the turret goes from activated to deactivated"); addField( "stateTransitionOnTimeout", TypeString, Offset(stateTransitionTimeout, AITurretShapeData), MaxStates, "Name of the state to transition to when we have been in this state " "for stateTimeoutValue seconds." ); addField( "stateTimeoutValue", TypeF32, Offset(stateTimeoutValue, AITurretShapeData), MaxStates, "Time in seconds to wait before transitioning to stateTransitionOnTimeout." ); addField( "stateWaitForTimeout", TypeBool, Offset(stateWaitForTimeout, AITurretShapeData), MaxStates, "If false, this state ignores stateTimeoutValue and transitions " "immediately if other transition conditions are met." ); addField( "stateFire", TypeBool, Offset(stateFire, AITurretShapeData), MaxStates, "The first state with this set to true is the state entered by the " "client when it receives the 'fire' event." ); addField( "stateScan", TypeBool, Offset(stateScan, AITurretShapeData), MaxStates, "Indicates the turret should perform a continuous scan looking for targets." ); addField( "stateDirection", TypeBool, Offset(stateDirection, AITurretShapeData), MaxStates, "@brief Direction of the animation to play in this state.\n\n" "True is forward, false is backward." ); addField( "stateSequence", TypeString, Offset(stateSequence, AITurretShapeData), MaxStates, "Name of the sequence to play on entry to this state." ); addField( "stateScaleAnimation", TypeBool, Offset(stateScaleAnimation, AITurretShapeData), MaxStates, "If true, the timeScale of the stateSequence animation will be adjusted " "such that the sequence plays for stateTimeoutValue seconds. " ); addField( "stateScript", TypeCaseString, Offset(stateScript, AITurretShapeData), MaxStates, "@brief Method to execute on entering this state.\n\n" "Scoped to AITurretShapeData."); endArray( "States" ); Parent::initPersistFields(); }
void SettingsSerializer::readSerialized() { QFile f(path); if (!f.open(QIODevice::ReadOnly)) { qWarning() << "Couldn't open file"; return; } QByteArray data = f.readAll(); f.close(); // Decrypt if (tox_is_data_encrypted(reinterpret_cast<uint8_t*>(data.data()))) { if (password.isEmpty()) { qCritical() << "The settings file is encrypted, but we don't have a password!"; return; } Core* core = Nexus::getCore(); uint8_t salt[TOX_PASS_SALT_LENGTH]; tox_get_salt(reinterpret_cast<uint8_t *>(data.data()), salt); auto passkey = core->createPasskey(password, salt); data = core->decryptData(data, *passkey); if (data.isEmpty()) { qCritical() << "Failed to decrypt the settings file"; return; } } else { if (!password.isEmpty()) qWarning() << "We have a password, but the settings file is not encrypted"; } if (memcmp(data.data(), magic, 4)) { qWarning() << "Bad magic!"; return; } data = data.mid(4); QDataStream stream(&data, QIODevice::ReadOnly); stream.setVersion(QDataStream::Qt_5_0); while (!stream.atEnd()) { RecordTag tag; readStream(stream, tag); if (tag == RecordTag::Value) { QByteArray key; QByteArray value; readStream(stream, key); readStream(stream, value); setValue(QString::fromUtf8(key), QVariant(QString::fromUtf8(value))); } else if (tag == RecordTag::GroupStart) { QByteArray prefix; readStream(stream, prefix); beginGroup(QString::fromUtf8(prefix)); } else if (tag == RecordTag::ArrayStart) { QByteArray prefix; readStream(stream, prefix); beginReadArray(QString::fromUtf8(prefix)); QByteArray sizeData; readStream(stream, sizeData); if (sizeData.isEmpty()) { qWarning("The personal save file is corrupted!"); return; } int size = dataToVInt(sizeData); arrays[array].size = qMax(size, arrays[array].size); } else if (tag == RecordTag::ArrayValue) { QByteArray indexData; readStream(stream, indexData); if (indexData.isEmpty()) { qWarning("The personal save file is corrupted!"); return; } setArrayIndex(dataToVInt(indexData)); QByteArray key; QByteArray value; readStream(stream, key); readStream(stream, value); setValue(QString::fromUtf8(key), QVariant(QString::fromUtf8(value))); } else if (tag == RecordTag::ArrayEnd) { endArray(); } } group = array = -1; }
void JsonStreamingParser::parse(char c) { //System.out.print(c); // valid whitespace characters in JSON (from RFC4627 for JSON) include: // space, horizontal tab, line feed or new line, and carriage return. // thanks: // http://stackoverflow.com/questions/16042274/definition-of-whitespace-in-json if ((c == ' ' || c == '\t' || c == '\n' || c == '\r') && !(state == STATE_IN_STRING || state == STATE_UNICODE || state == STATE_START_ESCAPE || state == STATE_IN_NUMBER || state == STATE_DONE)) { return; } switch (state) { case STATE_IN_STRING: if (c == '"') { endString(); } else if (c == '\\') { state = STATE_START_ESCAPE; } else if ((c < 0x1f) || (c == 0x7f)) { //throw new RuntimeException("Unescaped control character encountered: " + c + " at position" + characterCounter); } else { buffer[bufferPos] = c; bufferPos++; } break; case STATE_IN_ARRAY: if (c == ']') { endArray(); } else { startValue(c); } break; case STATE_IN_OBJECT: if (c == '}') { endObject(); } else if (c == '"') { startKey(); } else { //throw new RuntimeException("Start of string expected for object key. Instead got: " + c + " at position" + characterCounter); } break; case STATE_END_KEY: if (c != ':') { //throw new RuntimeException("Expected ':' after key. Instead got " + c + " at position" + characterCounter); } state = STATE_AFTER_KEY; break; case STATE_AFTER_KEY: startValue(c); break; case STATE_START_ESCAPE: processEscapeCharacters(c); break; case STATE_UNICODE: processUnicodeCharacter(c); break; case STATE_UNICODE_SURROGATE: unicodeEscapeBuffer[unicodeEscapeBufferPos] = c; unicodeEscapeBufferPos++; if (unicodeEscapeBufferPos == 2) { endUnicodeSurrogateInterstitial(); } break; case STATE_AFTER_VALUE: { // not safe for size == 0!!! int within = stack[stackPos - 1]; if (within == STACK_OBJECT) { if (c == '}') { endObject(); } else if (c == ',') { state = STATE_IN_OBJECT; } else { //throw new RuntimeException("Expected ',' or '}' while parsing object. Got: " + c + ". " + characterCounter); } } else if (within == STACK_ARRAY) { if (c == ']') { endArray(); } else if (c == ',') { state = STATE_IN_ARRAY; } else { //throw new RuntimeException("Expected ',' or ']' while parsing array. Got: " + c + ". " + characterCounter); } } else { //throw new RuntimeException("Finished a literal, but unclear what state to move to. Last state: " + characterCounter); } }break; case STATE_IN_NUMBER: if (c >= '0' && c <= '9') { buffer[bufferPos] = c; bufferPos++; } else if (c == '.') { if (doesCharArrayContain(buffer, bufferPos, '.')) { //throw new RuntimeException("Cannot have multiple decimal points in a number. " + characterCounter); } else if (doesCharArrayContain(buffer, bufferPos, 'e')) { //throw new RuntimeException("Cannot have a decimal point in an exponent." + characterCounter); } buffer[bufferPos] = c; bufferPos++; } else if (c == 'e' || c == 'E') { if (doesCharArrayContain(buffer, bufferPos, 'e')) { //throw new RuntimeException("Cannot have multiple exponents in a number. " + characterCounter); } buffer[bufferPos] = c; bufferPos++; } else if (c == '+' || c == '-') { char last = buffer[bufferPos - 1]; if (!(last == 'e' || last == 'E')) { //throw new RuntimeException("Can only have '+' or '-' after the 'e' or 'E' in a number." + characterCounter); } buffer[bufferPos] = c; bufferPos++; } else { endNumber(); // we have consumed one beyond the end of the number parse(c); } break; case STATE_IN_TRUE: buffer[bufferPos] = c; bufferPos++; if (bufferPos == 4) { endTrue(); } break; case STATE_IN_FALSE: buffer[bufferPos] = c; bufferPos++; if (bufferPos == 5) { endFalse(); } break; case STATE_IN_NULL: buffer[bufferPos] = c; bufferPos++; if (bufferPos == 4) { endNull(); } break; case STATE_DONE: myListener->startDocument(); if (c == '[') { startArray(); } else if (c == '{') { startObject(); } else { // throw new ParsingError($this->_line_number, // $this->_char_number, // "Document must start with object or array."); } break; //case STATE_DONE: // throw new ParsingError($this->_line_number, $this->_char_number, // "Expected end of document."); //default: // throw new ParsingError($this->_line_number, $this->_char_number, // "Internal error. Reached an unknown state: ".$this->_state); } characterCounter++; }
void Material::initPersistFields() { addField("mapTo", TypeRealString, Offset(mMapTo, Material), "Used to map this material to the material name used by TSShape." ); addArray( "Stages", MAX_STAGES ); addField("diffuseColor", TypeColorF, Offset(mDiffuse, Material), MAX_STAGES, "This color is multiplied against the diffuse texture color. If no diffuse texture " "is present this is the material color." ); addField("diffuseMap", TypeImageFilename, Offset(mDiffuseMapFilename, Material), MAX_STAGES, "The diffuse color texture map." ); addField("overlayMap", TypeImageFilename, Offset(mOverlayMapFilename, Material), MAX_STAGES, "A secondary diffuse color texture map which will use the second texcoord of a mesh." ); addField("lightMap", TypeImageFilename, Offset(mLightMapFilename, Material), MAX_STAGES, "The lightmap texture used with pureLight." ); addField("toneMap", TypeImageFilename, Offset(mToneMapFilename, Material), MAX_STAGES, "The tonemap texture used with pureLight."); addField("detailMap", TypeImageFilename, Offset(mDetailMapFilename, Material), MAX_STAGES, "A typically greyscale detail texture additively blended into the material." ); addField("detailScale", TypePoint2F, Offset(mDetailScale, Material), MAX_STAGES, "The scale factor for the detail map." ); addField( "normalMap", TypeImageFilename, Offset(mNormalMapFilename, Material), MAX_STAGES, "The normal map texture. You can use the DXTnm format only when per-pixel " "specular highlights are disabled, or a specular map is in use." ); addField( "detailNormalMap", TypeImageFilename, Offset(mDetailNormalMapFilename, Material), MAX_STAGES, "A second normal map texture applied at the detail scale. You can use the DXTnm " "format only when per-pixel specular highlights are disabled." ); addField( "detailNormalMapStrength", TypeF32, Offset(mDetailNormalMapStrength, Material), MAX_STAGES, "Used to scale the strength of the detail normal map when blended with the base normal map." ); addField("specular", TypeColorF, Offset(mSpecular, Material), MAX_STAGES, "The color of the specular highlight when not using a specularMap." ); addField("specularPower", TypeF32, Offset(mSpecularPower, Material), MAX_STAGES, "The hardness of the specular highlight when not using a specularMap." ); addField("specularStrength", TypeF32, Offset(mSpecularStrength, Material), MAX_STAGES, "The strength of the specular highlight when not using a specularMap." ); addField("pixelSpecular", TypeBool, Offset(mPixelSpecular, Material), MAX_STAGES, "This enables per-pixel specular highlights controlled by the alpha channel of the " "normal map texture. Note that if pixel specular is enabled the DXTnm format will not " "work with your normal map, unless you are also using a specular map." ); addProtectedField( "accuEnabled", TYPEID< bool >(), Offset( mAccuEnabled, Material ), &_setAccuEnabled, &defaultProtectedGetFn, MAX_STAGES, "Accumulation texture." ); addField("accuScale", TypeF32, Offset(mAccuScale, Material), MAX_STAGES, "The scale that is applied to the accu map texture. You can use this to fit the texture to smaller or larger objects."); addField("accuDirection", TypeF32, Offset(mAccuDirection, Material), MAX_STAGES, "The direction of the accumulation. Chose whether you want the accu map to go from top to bottom (ie. snow) or upwards (ie. mold)."); addField("accuStrength", TypeF32, Offset(mAccuStrength, Material), MAX_STAGES, "The strength of the accu map. This changes the transparency of the accu map texture. Make it subtle or add more contrast."); addField("accuCoverage", TypeF32, Offset(mAccuCoverage, Material), MAX_STAGES, "The coverage ratio of the accu map texture. Use this to make the entire shape pick up some of the accu map texture or none at all."); addField("accuSpecular", TypeF32, Offset(mAccuSpecular, Material), MAX_STAGES, "Changes specularity to this value where the accumulated material is present."); addField( "specularMap", TypeImageFilename, Offset(mSpecularMapFilename, Material), MAX_STAGES, "The specular map texture. The RGB channels of this texture provide a per-pixel replacement for the 'specular' parameter on the material. " "If this texture contains alpha information, the alpha channel of the texture will be used as the gloss map. " "This provides a per-pixel replacement for the 'specularPower' on the material" ); addField( "parallaxScale", TypeF32, Offset(mParallaxScale, Material), MAX_STAGES, "Enables parallax mapping and defines the scale factor for the parallax effect. Typically " "this value is less than 0.4 else the effect breaks down." ); addField( "useAnisotropic", TypeBool, Offset(mUseAnisotropic, Material), MAX_STAGES, "Use anisotropic filtering for the textures of this stage." ); addField("envMap", TypeImageFilename, Offset(mEnvMapFilename, Material), MAX_STAGES, "The name of an environment map cube map to apply to this material." ); addField("vertLit", TypeBool, Offset(mVertLit, Material), MAX_STAGES, "If true the vertex color is used for lighting." ); addField( "vertColor", TypeBool, Offset( mVertColor, Material ), MAX_STAGES, "If enabled, vertex colors are premultiplied with diffuse colors." ); addField("minnaertConstant", TypeF32, Offset(mMinnaertConstant, Material), MAX_STAGES, "The Minnaert shading constant value. Must be greater than 0 to enable the effect." ); addField("subSurface", TypeBool, Offset(mSubSurface, Material), MAX_STAGES, "Enables the subsurface scattering approximation." ); addField("subSurfaceColor", TypeColorF, Offset(mSubSurfaceColor, Material), MAX_STAGES, "The color used for the subsurface scattering approximation." ); addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES, "The 0 to 1 rolloff factor used in the subsurface scattering approximation." ); addField("glow", TypeBool, Offset(mGlow, Material), MAX_STAGES, "Enables rendering this material to the glow buffer." ); addField("emissive", TypeBool, Offset(mEmissive, Material), MAX_STAGES, "Enables emissive lighting for the material." ); addField("doubleSided", TypeBool, Offset(mDoubleSided, Material), "Disables backface culling casing surfaces to be double sided. " "Note that the lighting on the backside will be a mirror of the front " "side of the surface." ); addField("animFlags", TYPEID< AnimType >(), Offset(mAnimFlags, Material), MAX_STAGES, "The types of animation to play on this material." ); addField("scrollDir", TypePoint2F, Offset(mScrollDir, Material), MAX_STAGES, "The scroll direction in UV space when scroll animation is enabled." ); addField("scrollSpeed", TypeF32, Offset(mScrollSpeed, Material), MAX_STAGES, "The speed to scroll the texture in UVs per second when scroll animation is enabled." ); addField("rotSpeed", TypeF32, Offset(mRotSpeed, Material), MAX_STAGES, "The speed to rotate the texture in degrees per second when rotation animation is enabled." ); addField("rotPivotOffset", TypePoint2F, Offset(mRotPivotOffset, Material), MAX_STAGES, "The piviot position in UV coordinates to center the rotation animation." ); addField("waveType", TYPEID< WaveType >(), Offset(mWaveType, Material), MAX_STAGES, "The type of wave animation to perform when wave animation is enabled." ); addField("waveFreq", TypeF32, Offset(mWaveFreq, Material), MAX_STAGES, "The wave frequency when wave animation is enabled." ); addField("waveAmp", TypeF32, Offset(mWaveAmp, Material), MAX_STAGES, "The wave amplitude when wave animation is enabled." ); addField("sequenceFramePerSec", TypeF32, Offset(mSeqFramePerSec, Material), MAX_STAGES, "The number of frames per second for frame based sequence animations if greater than zero." ); addField("sequenceSegmentSize", TypeF32, Offset(mSeqSegSize, Material), MAX_STAGES, "The size of each frame in UV units for sequence animations." ); // Texture atlasing addField("cellIndex", TypePoint2I, Offset(mCellIndex, Material), MAX_STAGES, "@internal" ); addField("cellLayout", TypePoint2I, Offset(mCellLayout, Material), MAX_STAGES, "@internal"); addField("cellSize", TypeS32, Offset(mCellSize, Material), MAX_STAGES, "@internal"); addField("bumpAtlas", TypeBool, Offset(mNormalMapAtlas, Material), MAX_STAGES, "@internal"); // For backwards compatibility. // // They point at the new 'map' fields, but reads always return // an empty string and writes only apply if the value is not empty. // addProtectedField("baseTex", TypeImageFilename, Offset(mDiffuseMapFilename, Material), defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES, "For backwards compatibility.\n@see diffuseMap\n" ); addProtectedField("detailTex", TypeImageFilename, Offset(mDetailMapFilename, Material), defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES, "For backwards compatibility.\n@see detailMap\n"); addProtectedField("overlayTex", TypeImageFilename, Offset(mOverlayMapFilename, Material), defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES, "For backwards compatibility.\n@see overlayMap\n"); addProtectedField("bumpTex", TypeImageFilename, Offset(mNormalMapFilename, Material), defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES, "For backwards compatibility.\n@see normalMap\n"); addProtectedField("envTex", TypeImageFilename, Offset(mEnvMapFilename, Material), defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES, "For backwards compatibility.\n@see envMap\n"); addProtectedField("colorMultiply", TypeColorF, Offset(mDiffuse, Material), defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES, "For backwards compatibility.\n@see diffuseColor\n"); endArray( "Stages" ); addField( "castShadows", TypeBool, Offset(mCastShadows, Material), "If set to false the lighting system will not cast shadows from this material." ); addField("planarReflection", TypeBool, Offset(mPlanarReflection, Material), "@internal" ); addField("translucent", TypeBool, Offset(mTranslucent, Material), "If true this material is translucent blended." ); addField("translucentBlendOp", TYPEID< BlendOp >(), Offset(mTranslucentBlendOp, Material), "The type of blend operation to use when the material is translucent." ); addField("translucentZWrite", TypeBool, Offset(mTranslucentZWrite, Material), "If enabled and the material is translucent it will write into the depth buffer." ); addField("alphaTest", TypeBool, Offset(mAlphaTest, Material), "Enables alpha test when rendering the material.\n@see alphaRef\n" ); addField("alphaRef", TypeS32, Offset(mAlphaRef, Material), "The alpha reference value for alpha testing. Must be between 0 to 255.\n@see alphaTest\n" ); addField("cubemap", TypeRealString, Offset(mCubemapName, Material), "The name of a CubemapData for environment mapping." ); addField("dynamicCubemap", TypeBool, Offset(mDynamicCubemap, Material), "Enables the material to use the dynamic cubemap from the ShapeBase object its applied to." ); addGroup( "Behavioral" ); addField( "showFootprints", TypeBool, Offset( mShowFootprints, Material ), "Whether to show player footprint decals on this material.\n\n" "@see PlayerData::decalData" ); addField( "showDust", TypeBool, Offset( mShowDust, Material ), "Whether to emit dust particles from a shape moving over the material. This is, for example, used by " "vehicles or players to decide whether to show dust trails." ); addField( "effectColor", TypeColorF, Offset( mEffectColor, Material ), NUM_EFFECT_COLOR_STAGES, "If #showDust is true, this is the set of colors to use for the ParticleData of the dust " "emitter.\n\n" "@see ParticleData::colors" ); addField( "footstepSoundId", TypeS32, Offset( mFootstepSoundId, Material ), "What sound to play from the PlayerData sound list when the player walks over the material. -1 (default) to not play any sound.\n" "\n" "The IDs are:\n\n" "- 0: PlayerData::FootSoftSound\n" "- 1: PlayerData::FootHardSound\n" "- 2: PlayerData::FootMetalSound\n" "- 3: PlayerData::FootSnowSound\n" "- 4: PlayerData::FootShallowSound\n" "- 5: PlayerData::FootWadingSound\n" "- 6: PlayerData::FootUnderwaterSound\n" "- 7: PlayerData::FootBubblesSound\n" "- 8: PlayerData::movingBubblesSound\n" "- 9: PlayerData::waterBreathSound\n" "- 10: PlayerData::impactSoftSound\n" "- 11: PlayerData::impactHardSound\n" "- 12: PlayerData::impactMetalSound\n" "- 13: PlayerData::impactSnowSound\n" "- 14: PlayerData::impactWaterEasy\n" "- 15: PlayerData::impactWaterMedium\n" "- 16: PlayerData::impactWaterHard\n" "- 17: PlayerData::exitingWater\n" ); addField( "customFootstepSound", TypeSFXTrackName, Offset( mFootstepSoundCustom, Material ), "The sound to play when the player walks over the material. If this is set, it overrides #footstepSoundId. This field is " "useful for directly assigning custom footstep sounds to materials without having to rely on the PlayerData sound assignment.\n\n" "@warn Be aware that materials are client-side objects. This means that the SFXTracks assigned to materials must be client-side, too." ); addField( "impactSoundId", TypeS32, Offset( mImpactSoundId, Material ), "What sound to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater " "than PlayerData::groundImpactMinSpeed.\n\n" "For a list of IDs, see #footstepSoundId" ); addField( "customImpactSound", TypeSFXTrackName, Offset( mImpactSoundCustom, Material ), "The sound to play when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed. " "If this is set, it overrides #impactSoundId. This field is useful for directly assigning custom impact sounds to materials " "without having to rely on the PlayerData sound assignment.\n\n" "@warn Be aware that materials are client-side objects. This means that the SFXTracks assigned to materials must be client-side, too." ); //Deactivate these for the moment as they are not used. #if 0 addField( "friction", TypeF32, Offset( mFriction, Material ) ); addField( "directSoundOcclusion", TypeF32, Offset( mDirectSoundOcclusion, Material ) ); addField( "reverbSoundOcclusion", TypeF32, Offset( mReverbSoundOcclusion, Material ) ); #endif endGroup( "Behavioral" ); Parent::initPersistFields(); }
void SFXPlayList::initPersistFields() { addGroup( "Sound" ); addField( "random", TYPEID< ERandomMode >(), Offset( mRandomMode, SFXPlayList ), "Slot playback order randomization pattern.\n" "By setting this field to something other than \"NotRandom\" to order in which slots of the " "playlist are processed can be changed from sequential to a random pattern. This allows to " "to create more varied playback patterns.\n" "Defaults to \"NotRandom\"." ); addField( "loopMode", TYPEID< ELoopMode >(), Offset( mLoopMode, SFXPlayList ), "Behavior when description has looping enabled.\n" "The loop mode determines whether the list will loop over a single slot or loop over " "all the entire list of slots being played.\n\n" "@see SFXDescription::isLooping" ); addField( "numSlotsToPlay", TypeS32, Offset( mNumSlotsToPlay, SFXPlayList ), "Number of slots to play.\n" "Up to a maximum of 16, this field determines the number of slots that are taken from the " "list for playback. Only slots that have a valid #track assigned will be considered for " "this." ); addArray( "slots", NUM_SLOTS ); addField( "track", TypeSFXTrackName, Offset( mSlots.mTrack, SFXPlayList ), NUM_SLOTS, "Track to play in this slot.\n" "This must be set for the slot to be considered for playback. Other settings for a slot " "will not take effect except this field is set." ); addField( "replay", TYPEID< EReplayMode >(), Offset( mSlots.mReplayMode, SFXPlayList ), NUM_SLOTS, "Behavior when an already playing sound is encountered on this slot from a previous cycle.\n" "Each slot can have an arbitrary number of sounds playing on it from previous cycles. This field determines " "how SFXController will handle these sources." ); addField( "transitionIn", TYPEID< ETransitionMode >(), Offset( mSlots.mTransitionIn, SFXPlayList ), NUM_SLOTS, "Behavior when moving into this slot.\n" "After the delayIn time has expired (if any), this slot determines what the controller " "will do before actually playing the slot." ); addField( "transitionOut", TYPEID< ETransitionMode >(), Offset( mSlots.mTransitionOut, SFXPlayList ), NUM_SLOTS, "Behavior when moving out of this slot.\n" "After the #detailTimeOut has expired (if any), this slot determines what the controller " "will do before moving on to the next slot." ); addField( "delayTimeIn", TypeF32, Offset( mSlots.mDelayTimeIn.mValue, SFXPlayList ), NUM_SLOTS, "Seconds to wait after moving into slot before #transitionIn." ); addField( "delayTimeInVariance", TypePoint2F, Offset( mSlots.mDelayTimeIn.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #delayTimeIn.\n\n" "@ref SFXPlayList_randomization\n" ); addField( "delayTimeOut", TypeF32, Offset( mSlots.mDelayTimeOut.mValue, SFXPlayList ), NUM_SLOTS, "Seconds to wait before moving out of slot after #transitionOut." ); addField( "delayTimeOutVariance", TypePoint2F, Offset( mSlots.mDelayTimeOut.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #delayTimeOut.\n\n" "@ref SFXPlayList_randomization\n" ); addField( "fadeTimeIn", TypeF32, Offset( mSlots.mFadeTimeIn.mValue, SFXPlayList ), NUM_SLOTS, "Seconds to fade sound in (-1 to use the track's own fadeInTime.)\n" "@see SFXDescription::fadeTimeIn" ); addField( "fadeTimeInVariance", TypePoint2F, Offset( mSlots.mFadeTimeIn.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #fadeInTime.\n\n" "@ref SFXPlayList_randomization\n" ); addField( "fadeTimeOut", TypeF32, Offset( mSlots.mFadeTimeOut.mValue, SFXPlayList ), NUM_SLOTS, "Seconds to fade sound out (-1 to use the track's own fadeOutTime.)\n" "@see SFXDescription::fadeTimeOut" ); addField( "fadeTimeOutVariance", TypePoint2F, Offset( mSlots.mFadeTimeOut.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #fadeOutTime\n\n" "@ref SFXPlayList_randomization\n" ); addField( "referenceDistance", TypeF32, Offset( mSlots.mMinDistance.mValue, SFXPlayList ), NUM_SLOTS, "@c referenceDistance to set for 3D sounds in this slot (<1 to use @c referenceDistance of track's own description).\n" "@see SFXDescription::referenceDistance" ); addField( "referenceDistanceVariance", TypePoint2F, Offset( mSlots.mMinDistance.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #referenceDistance.\n\n" "@ref SFXPlayList_randomization\n" ); addField( "maxDistance", TypeF32, Offset( mSlots.mMaxDistance.mValue, SFXPlayList ), NUM_SLOTS, "@c maxDistance to apply to 3D sounds in this slot (<1 to use @c maxDistance of track's own description).\n" "@see SFXDescription::maxDistance" ); addField( "maxDistanceVariance", TypePoint2F, Offset( mSlots.mMaxDistance.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #maxDistance.\n\n" "@ref SFXPlayList_randomization\n" ); addField( "volumeScale", TypeF32, Offset( mSlots.mVolumeScale.mValue, SFXPlayList ), NUM_SLOTS, "Scale factor to apply to volume of sounds played on this list slot.\n" "This value will scale the actual volume level set on the track assigned to the slot, i.e. a value of 0.5 will " "cause the track to play at half-volume." ); addField( "volumeScaleVariance", TypePoint2F, Offset( mSlots.mVolumeScale.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #volumeScale.\n\n" "@ref SFXPlayList_randomization\n" ); addField( "pitchScale", TypeF32, Offset( mSlots.mPitchScale.mValue, SFXPlayList ), NUM_SLOTS, "Scale factor to apply to pitch of sounds played on this list slot.\n" "This value will scale the actual pitch set on the track assigned to the slot, i.e. a value of 0.5 will " "cause the track to play at half its assigned speed." ); addField( "pitchScaleVariance", TypePoint2F, Offset( mSlots.mPitchScale.mVariance, SFXPlayList ), NUM_SLOTS, "Bounds on randomization of #pitchScale.\n\n" "@ref SFXPlayList_randomization\n" ); addField( "repeatCount", TypeS32, Offset( mSlots.mRepeatCount, SFXPlayList ), NUM_SLOTS, "Number of times to loop this slot." ); addField( "state", TypeSFXStateName, Offset( mSlots.mState, SFXPlayList ), NUM_SLOTS, "State that must be active for this slot to play.\n\n" "@ref SFXPlayList_states" ); addField( "stateMode", TYPEID< EStateMode >(), Offset( mSlots.mStateMode, SFXPlayList ), NUM_SLOTS, "Behavior when assigned state is deactivated while slot is playing.\n\n" "@ref SFXPlayList_states" ); endArray( "slots" ); endGroup( "Sound" ); addGroup( "Debug" ); addField( "trace", TypeBool, Offset( mTrace, SFXPlayList ), "Enable/disable execution tracing for this playlist (local only).\n" "If this is true, SFXControllers attached to the list will automatically run in trace mode." ); endGroup( "Debug" ); Parent::initPersistFields(); }
void WaterObject::initPersistFields() { addGroup( "WaterObject" ); addProtectedField( "density", TypeF32, Offset( mDensity, WaterObject ), &WaterObject::_checkDensity, &defaultProtectedGetFn, "Affects buoyancy of an object, thus affecting the Z velocity of a player (jumping, falling, etc."); addField( "viscosity", TypeF32, Offset( mViscosity, WaterObject ), "Affects drag force applied to an object submerged in this container." ); addField( "liquidType", TypeRealString, Offset( mLiquidType, WaterObject ), "Liquid type of WaterBlock, such as water, ocean, lava" " Currently only Water is defined and used."); addField( "baseColor", TypeColorI, Offset( mWaterFogData.color, WaterObject ), "Changes color of water fog." ); addField( "fresnelBias", TypeF32, Offset( mFresnelBias, WaterObject ), "Extent of fresnel affecting reflection fogging." ); addField( "fresnelPower", TypeF32, Offset( mFresnelPower, WaterObject ), "Measures intensity of affect on reflection based on fogging." ); addField( "specularPower", TypeF32, Offset( mSpecularPower, WaterObject ), "Power used for specularity on the water surface ( sun only )." ); addField( "specularColor", TypeColorF, Offset( mSpecularColor, WaterObject ), "Color used for specularity on the water surface ( sun only )." ); addField( "emissive", TypeBool, Offset( mEmissive, WaterObject ), "When true the water colors don't react to changes to environment lighting." ); addArray( "Waves (vertex undulation)", MAX_WAVES ); addField( "waveDir", TypePoint2F, Offset( mWaveDir, WaterObject ), MAX_WAVES, "Direction waves flow toward shores." ); addField( "waveSpeed", TypeF32, Offset( mWaveSpeed, WaterObject ), MAX_WAVES, "Speed of water undulation." ); addField( "waveMagnitude", TypeF32, Offset( mWaveMagnitude, WaterObject ), MAX_WAVES, "Height of water undulation." ); endArray( "Waves (vertex undulation)" ); addField( "overallWaveMagnitude", TypeF32, Offset( mOverallWaveMagnitude, WaterObject ), "Master variable affecting entire body" " of water's undulation" ); addField( "rippleTex", TypeImageFilename, Offset( mRippleTexName, WaterObject ), "Normal map used to simulate small surface ripples" ); addArray( "Ripples (texture animation)", MAX_WAVES ); addField( "rippleDir", TypePoint2F, Offset( mRippleDir, WaterObject ), MAX_WAVES, "Modifies the direction of ripples on the surface." ); addField( "rippleSpeed", TypeF32, Offset( mRippleSpeed, WaterObject ), MAX_WAVES, "Modifies speed of surface ripples."); addField( "rippleTexScale", TypePoint2F, Offset( mRippleTexScale, WaterObject ), MAX_WAVES, "Intensifies the affect of the normal map " "applied to the surface."); addField( "rippleMagnitude", TypeF32, Offset( mRippleMagnitude, WaterObject ), MAX_WAVES, "Intensifies the vertext modification of the surface." ); endArray( "Ripples (texture animation)" ); addField( "overallRippleMagnitude", TypeF32, Offset( mOverallRippleMagnitude, WaterObject ), "Master variable affecting entire surface"); addField( "foamTex", TypeImageFilename, Offset( mFoamTexName, WaterObject ), "Diffuse texture for foam in shallow water (advanced lighting only)" ); addArray( "Foam", MAX_FOAM ); addField( "foamDir", TypePoint2F, Offset( mFoamDir, WaterObject ), MAX_FOAM, "" ); addField( "foamSpeed", TypeF32, Offset( mFoamSpeed, WaterObject ), MAX_FOAM, ""); addField( "foamTexScale", TypePoint2F, Offset( mFoamTexScale, WaterObject ), MAX_FOAM, "" "applied to the surface."); addField( "foamOpacity", TypeF32, Offset( mFoamOpacity, WaterObject ), MAX_FOAM, "" ); endArray( "Foam" ); addField( "overallFoamOpacity", TypeF32, Offset( mOverallFoamOpacity, WaterObject ), "" ); addField( "foamMaxDepth", TypeF32, Offset( mFoamMaxDepth, WaterObject ), "" ); addField( "foamAmbientLerp", TypeF32, Offset( mFoamAmbientLerp, WaterObject ), "" ); addField( "foamRippleInfluence", TypeF32, Offset( mFoamRippleInfluence, WaterObject ), "" ); endGroup( "WaterObject" ); addGroup( "Reflect" ); addField( "cubemap", TypeCubemapName, Offset( mCubemapName, WaterObject ), "Cubemap used instead of reflection texture if fullReflect is off." ); addProtectedField( "fullReflect", TypeBool, Offset( mFullReflect, WaterObject ), &WaterObject::_setFullReflect, &defaultProtectedGetFn, "Enables dynamic reflection rendering." ); addField( "reflectivity", TypeF32, Offset( mReflectivity, WaterObject ), "Overall scalar to the reflectivity of the water surface." ); addField( "reflectPriority", TypeF32, Offset( mReflectorDesc.priority, WaterObject ), "Affects the sort order of reflected objects." ); addField( "reflectMaxRateMs", TypeS32, Offset( mReflectorDesc.maxRateMs, WaterObject ), "Affects the sort time of reflected objects." ); //addField( "reflectMaxDist", TypeF32, Offset( mReflectMaxDist, WaterObject ), "vert distance at which only cubemap color is used" ); //addField( "reflectMinDist", TypeF32, Offset( mReflectMinDist, WaterObject ), "vert distance at which only reflection color is used" ); addField( "reflectDetailAdjust", TypeF32, Offset( mReflectorDesc.detailAdjust, WaterObject ), "scale up or down the detail level for objects rendered in a reflection" ); addField( "reflectNormalUp", TypeBool, Offset( mReflectNormalUp, WaterObject ), "always use z up as the reflection normal" ); addField( "useOcclusionQuery", TypeBool, Offset( mReflectorDesc.useOcclusionQuery, WaterObject ), "turn off reflection rendering when occluded (delayed)." ); addField( "reflectTexSize", TypeS32, Offset( mReflectorDesc.texSize, WaterObject ), "The texture size used for reflections (square)" ); endGroup( "Reflect" ); addGroup( "Underwater Fogging" ); addField( "waterFogDensity", TypeF32, Offset( mWaterFogData.density, WaterObject ), "Intensity of underwater fogging." ); addField( "waterFogDensityOffset", TypeF32, Offset( mWaterFogData.densityOffset, WaterObject ), "Delta, or limit, applied to waterFogDensity." ); addField( "wetDepth", TypeF32, Offset( mWaterFogData.wetDepth, WaterObject ), "The depth in world units at which full darkening will be received," " giving a wet look to objects underwater." ); addField( "wetDarkening", TypeF32, Offset( mWaterFogData.wetDarkening, WaterObject ), "The refract color intensity scaled at wetDepth." ); endGroup( "Underwater Fogging" ); addGroup( "Misc" ); addField( "depthGradientTex", TypeImageFilename, Offset( mDepthGradientTexName, WaterObject ), "1D texture defining the base water color by depth" ); addField( "depthGradientMax", TypeF32, Offset( mDepthGradientMax, WaterObject ), "Depth in world units, the max range of the color gradient texture." ); endGroup( "Misc" ); addGroup( "Distortion" ); addField( "distortStartDist", TypeF32, Offset( mDistortStartDist, WaterObject ), "Determines start of distortion effect where water" " surface intersects the camera near plane."); addField( "distortEndDist", TypeF32, Offset( mDistortEndDist, WaterObject ), "Max distance that distortion algorithm is performed. " "The lower, the more distorted the effect."); addField( "distortFullDepth", TypeF32, Offset( mDistortFullDepth, WaterObject ), "Determines the scaling down of distortion " "in shallow water."); endGroup( "Distortion" ); addGroup( "Basic Lighting" ); addField( "clarity", TypeF32, Offset( mClarity, WaterObject ), "Relative opacity or transparency of the water surface." ); addField( "underwaterColor", TypeColorI, Offset( mUnderwaterColor, WaterObject ), "Changes the color shading of objects beneath" " the water surface."); endGroup( "Basic Lighting" ); addGroup( "Sound" ); addField( "soundAmbience", TypeSFXAmbienceName, Offset( mSoundAmbience, WaterObject ), "Ambient sound environment when listener is submerged." ); endGroup( "Sound" ); Parent::initPersistFields(); Con::addVariable( "$WaterObject::wireframe", TypeBool, &smWireframe, "If true, will render the wireframe of the WaterObject.\n" "@ingroup Water\n"); }
void ArrowMarker::draw(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &) const { const int x0 = xMap.transform(d_rect.left()); const int y0 = yMap.transform(d_rect.top()); const int x1 = xMap.transform(d_rect.right()); const int y1 = yMap.transform(d_rect.bottom()); p->save(); QPen pen = linePen(); p->setPen(pen); QBrush brush = QBrush(pen.color(), Qt::SolidPattern); QwtPainter::drawLine(p,x0,y0,x1,y1); p->restore(); if (d_end_arrow){ p->save(); p->translate(x1,y1); const double t = theta(x0, y0, x1, y1); p->rotate(-t); QPolygon endArray(3); endArray[0] = QPoint(0,0); int d=(int)floor(d_head_length*tan(M_PI*d_head_angle/180.0)+0.5); endArray[1] = QPoint(-d_head_length,d); endArray[2] = QPoint(-d_head_length,-d); p->setPen(QPen(pen.color(), pen.width(), Qt::SolidLine)); if (d_fill_head) p->setBrush(brush); QwtPainter::drawPolygon(p,endArray); p->restore(); } if (d_start_arrow){ p->save(); p->translate(x0,y0); const double t = theta(x0, y0, x1, y1); p->rotate(-t); QPolygon startArray(3); startArray[0] = QPoint(0,0); int d=(int)floor(d_head_length*tan(M_PI*d_head_angle/180.0)+0.5); startArray[1] = QPoint(d_head_length,d); startArray[2] = QPoint(d_head_length,-d); p->setPen(QPen(pen.color(), pen.width(), Qt::SolidLine)); if (d_fill_head) p->setBrush(brush); QwtPainter::drawPolygon(p,startArray); p->restore(); } if (d_editable) { p->save(); p->setPen(QPen(Qt::black,1,Qt::SolidLine)); QRect handler(QPoint(0,0), QSize(10,10)); handler.moveCenter(startPoint()); p->fillRect(handler, QBrush(Qt::black)); handler.moveCenter(endPoint()); p->fillRect(handler, QBrush(Qt::black)); p->restore(); } }
Config::~Config() { beginGroup("General"); setValue("language", language); setValue("recentFiles", recentFiles); setValue("openFiles", openFiles); setValue("lastFile", lastFile); setValue("mainWindowGeometry", mainWindowGeometry); setValue("mainWindowState", mainWindowState); setValue("helpWindowGeometry", helpWindowGeometry); endGroup(); beginGroup("Editor"); setValue("fontFamily", fontFamily); setValue("fontSize", fontSize); setValue("tabIndents", tabIndents); setValue("autoIndent", autoIndent); setValue("backUnindent", backUnindent); setValue("spaceTabs", spaceTabs); setValue("indentSize", indentSize); setValue("tabSize", tabSize); setValue("whitespaces", whitespaces); QMapIterator<QString, QTextCharFormat> it(colorScheme); beginWriteArray("ColorScheme"); int i = 0; while (it.hasNext()) { it.next(); setArrayIndex(i++); setValue("type", it.key()); setValue("italic", it.value().font().italic()); setValue("weihgt", it.value().font().weight()); setValue("foreground", it.value().foreground()); setValue("background", it.value().background()); } endArray(); endGroup(); // Editor beginGroup("Sessions"); setValue("leaveOpen", leaveOpen); setValue("sessions", sessions); setValue("sessionSplitter", sessionSplitter); endGroup(); beginGroup("Snippets"); setValue("snippetPath", snippetPath); setValue("snippetSplitter", snippetSplitter); endGroup(); beginGroup("SearchReplace"); findHistory.sort(); replaceHistory.sort(); setValue("findHistory", findHistory); setValue("replaceHistory", replaceHistory); setValue("matchCase", matchCase); setValue("regExp", regExp); setValue("allFiles", allFiles); endGroup(); }
Config::Config(QObject* parent) : QSettings(ORGNAME, PROGNAME, parent) { keywordsSorted = keywords.keywords.values(); keywordsSorted.sort(); languages.insert("English", "en_EN"); languages.insert("Russian", "ru_RU"); maxRecentFiles = 9; maxHistory = 10; beginGroup("General"); language = value("language", "English").toString(); recentFiles = value("recentFiles").toStringList(); openFiles = value("openFiles").toStringList(); lastFile = value("lastFile").toString(); mainWindowGeometry = value("mainWindowGeometry").toByteArray(); mainWindowState = value("mainWindowState").toByteArray(); helpWindowGeometry = value("helpWindowGeometry").toByteArray(); endGroup(); beginGroup("Editor"); fontFamily = value("fontFamily", "Courier New").toString(); fontSize = value("fontSize", 12).toInt(); tabIndents = value("tabIndents").toBool(); autoIndent = value("autoIndent").toBool(); backUnindent = value("backUnindent").toBool(); spaceTabs = value("spaceTabs", true).toBool(); indentSize = value("indentSize", 4).toInt(); tabSize = value("tabSize", 4).toInt(); whitespaces = value("whitespaces").toBool(); QTextCharFormat fmt; // формат по умолчанию, не изменяется fmt.setBackground(QColor(255, 255, 255, 0)) ; // прозрачный белый int size = beginReadArray("ColorScheme"); for (int i = 0; i < size; i++) { setArrayIndex(i); QString type = value("type").toString(); colorScheme.insert(type, fmt); colorScheme[type].setFontItalic(value("italic").toBool()); colorScheme[type].setFontWeight(value("weihgt").toInt()); colorScheme[type].setForeground(value("foreground").value<QColor>()); colorScheme[type].setBackground(value("background").value<QColor>()); } endArray(); QHashIterator<QString, QString> it(keywords.keywords); while (it.hasNext()) { it.next(); QString keyword = it.value(); keyword.replace("*", "\\*").replace("$", "\\$"); patterns.insert(it.key(), QRegExp(tr("\\b%1\\b").arg(keyword))); if (!colorScheme.contains(it.key())) // для всех слов пустая схема при size == 0 colorScheme.insert(it.key(), fmt); } // 1. для неключевых слов добавить шаблон patterns.insert("Parentheses", QRegExp("[\\(\\)\\[\\]]")); patterns.insert("Numbers", QRegExp("(^|\\s)[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?")); patterns.insert("Local Variables", QRegExp("\\$?\\?[\\w-]+")); patterns.insert("Global Variables", QRegExp("\\?\\*[\\w-]+\\*")); // 2. настроить схему по умолчанию if (!size) { colorScheme.insert("Constructs", fmt); colorScheme["Constructs"].setFontWeight(QFont::Bold); colorScheme["Constructs"].setForeground(Qt::darkBlue); colorScheme.insert("Strings", fmt); colorScheme["Strings"].setForeground(Qt::darkRed); colorScheme.insert("Comments", fmt); colorScheme["Comments"].setFontItalic(true); colorScheme["Comments"].setForeground(Qt::darkGreen); colorScheme.insert("Parentheses", fmt); colorScheme["Parentheses"].setFontWeight(QFont::Bold); colorScheme.insert("Numbers", fmt); colorScheme["Numbers"].setForeground(Qt::darkYellow); colorScheme.insert("Local Variables", fmt); colorScheme["Local Variables"].setForeground(Qt::darkYellow); colorScheme.insert("Global Variables", fmt); colorScheme["Global Variables"].setForeground(Qt::darkYellow); colorScheme.insert("Text", fmt); colorScheme["Text"].setForeground(Qt::black); colorScheme["Text"].setBackground(Qt::white); colorScheme.insert("Line Numbers", fmt); colorScheme["Line Numbers"].setForeground(Qt::gray); colorScheme["Line Numbers"].setBackground(QColor(30, 60, 90)); } endGroup(); // Editor beginGroup("Sessions"); leaveOpen = value("leaveOpen").toBool(); sessions = value("sessions").toMap(); sessionSplitter = value("sessionSplitter").toByteArray(); endGroup(); beginGroup("Snippets"); snippetPath = value("snippetPath").toString(); snippetSplitter = value("snippetSplitter").toByteArray(); endGroup(); beginGroup("SearchReplace"); findHistory = value("findHistory").toStringList(); replaceHistory = value("replaceHistory").toStringList(); matchCase = value("matchCase").toBool(); regExp = value("regExp").toBool(); allFiles = value("allFiles").toBool(); endGroup(); }
void Material::initPersistFields() { addField("mapTo", TypeRealString, Offset(mMapTo, Material)); addArray( "Stages", MAX_STAGES ); addField("diffuseColor", TypeColorF, Offset(mDiffuse, Material), MAX_STAGES); addField("colorMultiply", TypeColorF, Offset(mColorMultiply, Material), MAX_STAGES); addField("diffuseMap", TypeImageFilename, Offset(mDiffuseMapFilename, Material), MAX_STAGES); addField("baseTex", TypeImageFilename, Offset(mBaseTexFilename, Material), MAX_STAGES); // For backwards compatibility addField("overlayMap", TypeImageFilename, Offset(mOverlayMapFilename, Material), MAX_STAGES); addField("overlayTex", TypeImageFilename, Offset(mOverlayTexFilename, Material), MAX_STAGES); // For backwards compatibility addField("lightMap", TypeImageFilename, Offset(mLightMapFilename, Material), MAX_STAGES); addField("toneMap", TypeImageFilename, Offset(mToneMapFilename, Material), MAX_STAGES); addField("detailMap", TypeImageFilename, Offset(mDetailMapFilename, Material), MAX_STAGES); addField("detailTex", TypeImageFilename, Offset(mDetailTexFilename, Material), MAX_STAGES); // For backwards compatibility addField("detailScale", TypePoint2F, Offset(mDetailScale, Material), MAX_STAGES); addField( "normalMap", TypeImageFilename, Offset(mNormalMapFilename, Material), MAX_STAGES, NULL, "The normal map texture. You can use the DXTnm format only when per-pixel " "specular highlights are disabled, or a specular map is in use." ); addField( "bumpTex", TypeImageFilename, Offset(mBumpTexFilename, Material), MAX_STAGES, NULL, // For backwards compatibility "The normal map texture. You can use the DXTnm format only when per-pixel " "specular highlights are disabled, or a specular map is in use." ); addField("specular", TypeColorF, Offset(mSpecular, Material), MAX_STAGES); addField("specularPower", TypeF32, Offset(mSpecularPower, Material), MAX_STAGES); addField("pixelSpecular", TypeBool, Offset(mPixelSpecular, Material), MAX_STAGES, NULL, "This enables per-pixel specular highlights controlled by the alpha channel of the " "normal map texture. Note that if pixel specular is enabled the DXTnm format will not " "work with your normal map, unless you are also using a specular map." ); addField( "specularMap", TypeImageFilename, Offset(mSpecularMapFilename, Material), MAX_STAGES, NULL, "The specular map texture. The RGB channels of this texture provide a per-pixel replacement for the 'specular' parameter on the material. " "If this texture contains alpha information, the alpha channel of the texture will be used as the gloss map. " "This provides a per-pixel replacement for the 'specularPower' on the material" ); addField( "parallaxScale", TypeF32, Offset(mParallaxScale, Material), MAX_STAGES ); addField("envMap", TypeImageFilename, Offset(mEnvMapFilename, Material), MAX_STAGES); addField("envTex", TypeImageFilename, Offset(mEnvTexFilename, Material), MAX_STAGES); // For backwards compatibility addField("vertLit", TypeBool, Offset(mVertLit, Material), MAX_STAGES); addField("minnaertConstant", TypeF32, Offset(mMinnaertConstant, Material), MAX_STAGES); addField("subSurface", TypeBool, Offset(mSubSurface, Material), MAX_STAGES); addField("subSurfaceColor", TypeColorF, Offset(mSubSurfaceColor, Material), MAX_STAGES); addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES); addField("exposure", TypeS32, Offset(mExposure, Material), MAX_STAGES); addField("glow", TypeBool, Offset(mGlow, Material), MAX_STAGES); addField("emissive", TypeBool, Offset(mEmissive, Material), MAX_STAGES); addField("doubleSided", TypeBool, Offset(mDoubleSided, Material)); addField("animFlags", TypeBitMask32, Offset(mAnimFlags, Material), MAX_STAGES, &mAnimFlagTable ); addField("scrollDir", TypePoint2F, Offset(mScrollDir, Material), MAX_STAGES); addField("scrollSpeed", TypeF32, Offset(mScrollSpeed, Material), MAX_STAGES); addField("rotSpeed", TypeF32, Offset(mRotSpeed, Material), MAX_STAGES); addField("rotPivotOffset", TypePoint2F, Offset(mRotPivotOffset, Material), MAX_STAGES); addField("waveType", TypeEnum, Offset(mWaveType, Material), MAX_STAGES, &mWaveTypeTable ); addField("waveFreq", TypeF32, Offset(mWaveFreq, Material), MAX_STAGES); addField("waveAmp", TypeF32, Offset(mWaveAmp, Material), MAX_STAGES); addField("sequenceFramePerSec", TypeF32, Offset(mSeqFramePerSec, Material), MAX_STAGES); addField("sequenceSegmentSize", TypeF32, Offset(mSeqSegSize, Material), MAX_STAGES); endArray( "Stages" ); addField( "castShadows", TypeBool, Offset(mCastShadows, Material), "If set to false the lighting system will not cast shadows from this material." ); addField("planarReflection", TypeBool, Offset(mPlanarReflection, Material)); addField("translucent", TypeBool, Offset(mTranslucent, Material)); addField("translucentBlendOp", TypeEnum, Offset(mTranslucentBlendOp, Material), 1, &mBlendOpTable); addField("translucentZWrite", TypeBool, Offset(mTranslucentZWrite, Material)); addField("alphaTest", TypeBool, Offset(mAlphaTest, Material)); addField("alphaRef", TypeS32, Offset(mAlphaRef, Material)); addField("cubemap", TypeRealString, Offset(mCubemapName, Material)); addField("dynamicCubemap", TypeBool, Offset(mDynamicCubemap, Material)); addGroup( "Behavioral" ); addField( "showFootprints", TypeBool, Offset( mShowFootprints, Material ) ); addField( "showDust", TypeBool, Offset( mShowDust, Material ) ); addField( "effectColor", TypeColorF, Offset( mEffectColor, Material ), NUM_EFFECT_COLOR_STAGES ); addField( "footstepSoundId", TypeS32, Offset( mFootstepSoundId, Material ) ); addField( "customFootstepSound", TypeSFXProfilePtr, Offset( mFootstepSoundCustom, Material ) ); addField( "impactSoundId", TypeS32, Offset( mImpactSoundId, Material ) ); addField( "customImpactSound", TypeSFXProfilePtr, Offset( mImpactSoundCustom, Material ) ); addField( "friction", TypeF32, Offset( mFriction, Material ) ); endGroup( "Behavioral" ); Parent::initPersistFields(); }