void CheatsManager::OnWatchItemChanged(QTableWidgetItem* item) { if (m_updating) return; int index = item->data(INDEX_ROLE).toInt(); int column = item->data(COLUMN_ROLE).toInt(); switch (column) { case 0: m_watch[index].name = item->text(); break; case 2: m_watch[index].locked = item->checkState() == Qt::Checked; if (m_watch[index].locked) m_watch[index].locked_value = GetResultValue(m_results[index]); UpdatePatch(m_watch[index]); break; case 3: { const auto text = item->text(); u32 value = 0; switch (m_watch[index].type) { case DataType::Byte: value = text.toUShort(nullptr, 16) & 0xFF; break; case DataType::Short: value = text.toUShort(nullptr, 16); break; case DataType::Int: value = text.toUInt(nullptr, 16); break; case DataType::Float: { float f = text.toFloat(); std::memcpy(&value, &f, sizeof(float)); break; } default: break; } m_watch[index].locked_value = value; UpdatePatch(m_watch[index]); break; } } Update(); }
void cePatchMeshGL20::InitializePatches(unsigned stepSize) { if (stepSize == 0) stepSize = 1; for (unsigned i=0, j=_patches.size(); i<j; i++) { Patch* patch = _patches[i]; patch->stepP = stepSize; patch->stepQ = stepSize; UpdatePatch(patch); } }
void cePatchMeshGL20::Update(const ceRenderEnvironment &renderEnvironment, iDevice *device) { if (!_dirty && (renderEnvironment.Frame % 100) != 0) { return; } for (unsigned i=0, j=_patches.size(); i<j; i++) { Patch* patch = _patches[i]; ceVector3f diff = renderEnvironment.CameraLocation - patch->bbox.GetCenter(); float fact = diff.Length() / patch->maxDistance; unsigned stepP = (unsigned)(fact * (float)patch->maxStepP); unsigned stepQ = (unsigned)(fact * (float)patch->maxStepQ); stepP = 1 << (stepP > patch->maxStepP ? patch->maxStepP : stepP); stepQ = 1 << (stepQ > patch->maxStepQ ? patch->maxStepQ : stepQ); if (stepP != patch->stepP) { patch->dirty = true; patch->stepP = stepP; if (patch->neighbours[PN_NegQ]) patch->neighbours[PN_NegQ]->dirty = true; if (patch->neighbours[PN_PosQ]) patch->neighbours[PN_PosQ]->dirty = true; } if (stepQ != patch->stepQ) { patch->dirty = true; patch->stepQ = stepQ; if (patch->neighbours[PN_NegP]) patch->neighbours[PN_NegP]->dirty = true; if (patch->neighbours[PN_PosP]) patch->neighbours[PN_PosP]->dirty = true; } } for (unsigned i=0, j=_patches.size(); i<j; i++) { Patch* patch = _patches[i]; if (patch->dirty) { UpdatePatch (patch); } patch->dirty = false; } _dirty = false; }