TPolyLine3D* BasicHorizontalRectangularDetectorElement::GeneratePolyLine3D() { TPolyLine3D* pPolyLine = new TPolyLine3D(5); // printf("---------MinX: %f, Maxx:%f, Miny: %f, MaxY:%f, Z: %f\n", GetMinX(), GetMaxX(), GetMinY(), GetMaxY(), GetZOffset()); pPolyLine->SetPoint(0, GetMinX(), GetMinY(), GetZOffset()); pPolyLine->SetPoint(1, GetMaxX(), GetMinY(), GetZOffset()); pPolyLine->SetPoint(2, GetMaxX(), GetMaxY(), GetZOffset()); pPolyLine->SetPoint(3, GetMinX(), GetMaxY(), GetZOffset()); pPolyLine->SetPoint(4, GetMinX(), GetMinY(), GetZOffset()); return pPolyLine; }
void Camera::SetX(double x) { if ( !HasBounds() ) { this->x = x; } else { if ( x < GetMinX() ) this->x = GetMinX(); else if ( x > GetMaxX() ) this->x = GetMaxX(); else this->x = x; } }
void FunctionSimple::SetMaxX(float f) { // Offset is avg of min and max. m_offsetX = (f + GetMinX()) / 2.0f; // Multiplier is max - offset, or offset - min m_multiplierX = fabs(f - m_offsetX); }
bool FGAFRect::IntersectsRect(const FGAFRect& rect) const { return !( GetMaxX() < rect.GetMinX() || rect.GetMaxX() < GetMinX() || GetMaxY() < rect.GetMinY() || rect.GetMaxY() < GetMinY()); }
double XYDataset::GetMinValue(bool verticalAxis) { if (verticalAxis) { return GetMinY(); } else { return GetMinX(); } }
bool FGAFRect::ContainsPoint(const FVector2D& point) const { bool bRet = false; if (point.X >= GetMinX() && point.X <= GetMaxX() && point.Y >= GetMinY() && point.Y <= GetMaxY()) { bRet = true; } return bRet; }
void FGAFRect::Merge(const FGAFRect& rect) { float top1 = GetMaxY(); float left1 = GetMinX(); float right1 = GetMaxX(); float bottom1 = GetMinY(); float top2 = rect.GetMaxY(); float left2 = rect.GetMinX(); float right2 = rect.GetMaxX(); float bottom2 = rect.GetMinY(); Origin.X = FMath::Min(left1, left2); Origin.Y = FMath::Min(bottom1, bottom2); Size.Width = FMath::Max(right1, right2) - Origin.X; Size.Height = FMath::Max(top1, top2) - Origin.Y; }
bool BattleRideFighter::PreGetObject() { //获取战斗对象 PreGetObject1() ; if(!_target) return false; if(count > 3) return false; if(!count || (getPosX() == _battleTargetX && getPosY() == _battleTargetY ))// || getPosX() >= (FIELD_WIDTH - 100) ) { switch(count) { case 0: //第一次出发 { _battleTargetX = (getPosX() > (FIELD_WIDTH)/2) ? 100:(FIELD_WIDTH-100); break; } case 1: //回头 { _battleTargetX = GetMinX(); _battleTargetY = GetMinY(); break; } case 2: //停 { SetBattleTargetPos(getPosX(),getPosY()); break; } default: return false ; } count++; //COUT << "战将编号:" << static_cast<UInt32>(GetBSNumber()) << "目的地:" << static_cast<UInt32>(_battleTargetX) << " , " << static_cast<UInt32>(_battleTargetY) << std::endl; } if(!_battleTargetY) { _battleTargetY = _target->getPosY(); } BuildLocalStream(e_run); return true; }
void CUmbralActor::RebuildActorRenderables() { uint32 modelFolder = m_baseModelId % 10000; uint32 modelClass = m_baseModelId / 10000; const char* charaFolder = ""; const char* charaPrefix = ""; switch(modelClass) { case 1: charaFolder = "mon"; charaPrefix = "m"; break; case 2: charaFolder = "bgobj"; charaPrefix = "b"; break; case 4: charaFolder = "wep"; charaPrefix = "w"; break; default: assert(0); break; } uint32 subModelId = m_topModelId >> 10; uint32 variation = m_topModelId & 0x3FF; auto gamePath = CFileManager::GetGamePath(); auto modelPath = string_format("%s/client/chara/%s/%s%0.3d/equ/e%0.3d/top_mdl/0001", gamePath.string().c_str(), charaFolder, charaPrefix, modelFolder, subModelId); Framework::CStdStream inputStream(modelPath.c_str(), "rb"); auto modelResource = CSectionLoader::ReadSection(ResourceNodePtr(), inputStream); auto modelChunk = modelResource->SelectNode<CModelChunk>(); assert(modelChunk); if(!modelChunk) return; auto boundingBox = modelChunk->SelectNode<CCompChunk>(); CVector3 boxMin(boundingBox->GetMinX(), boundingBox->GetMinY(), boundingBox->GetMinZ()); CVector3 boxMax(boundingBox->GetMaxX(), boundingBox->GetMaxY(), boundingBox->GetMaxZ()); CVector3 modelSize = (boxMax - boxMin) / 2; CVector3 modelPos = (boxMax + boxMin) / 2; auto model = std::make_shared<CUmbralModel>(modelChunk); model->SetPosition(modelPos); model->SetScale(modelSize); AppendChild(model); auto modelBoundingSphere = model->GetBoundingSphere(); modelBoundingSphere.radius *= std::max(std::max(modelSize.x, modelSize.y), modelSize.z); modelBoundingSphere.position += modelPos; m_boundingSphere = modelBoundingSphere; uint32 textureId = 0; if(modelClass == 4) { uint32 varWepId = 1000000000 + (modelFolder * 1000000) + (subModelId * 1000) + variation; auto var = CWeaponVars::GetInstance().GetVarForId(varWepId); textureId = var.textureId; for(const auto& meshNode : model->GetChildren()) { if(auto mesh = std::dynamic_pointer_cast<CUmbralMesh>(meshNode)) { auto meshName = mesh->GetName(); int materialId = 0; if(meshName.find("_a") != std::string::npos) { materialId = 0; } if(meshName.find("_b") != std::string::npos) { materialId = 1; } if(meshName.find("_c") != std::string::npos) { materialId = 2; } if(meshName.find("_d") != std::string::npos) { assert(0); } const auto& varWepMaterial = var.materials[materialId]; auto material = mesh->GetMaterial(); ReplaceMaterialParam(material, "ps_diffuseColor", varWepMaterial.diffuseColor); ReplaceMaterialParam(material, "ps_multiDiffuseColor", varWepMaterial.multiDiffuseColor); ReplaceMaterialParam(material, "ps_specularColor", varWepMaterial.specularColor); ReplaceMaterialParam(material, "ps_multiSpecularColor", varWepMaterial.multiSpecularColor); ReplaceMaterialParam(material, "ps_reflectivity", varWepMaterial.specularColor); ReplaceMaterialParam(material, "ps_multiReflectivity", varWepMaterial.multiSpecularColor); ReplaceMaterialParam(material, "ps_shininess", varWepMaterial.shininess); ReplaceMaterialParam(material, "ps_multiShininess", varWepMaterial.multiShininess); mesh->SetActivePolyGroups(var.polyGroupState); } } } { auto texturePath = string_format("%s/client/chara/%s/%s%0.3d/equ/e%0.3d/top_tex2/%0.4d", gamePath.string().c_str(), charaFolder, charaPrefix, modelFolder, subModelId, textureId); Framework::CStdStream inputStream(texturePath.c_str(), "rb"); auto textureResource = CSectionLoader::ReadSection(ResourceNodePtr(), inputStream); model->SetLocalTexture(textureResource); } m_renderableDirty = false; }
fixed GetYAtMinX() const { return GetYAt(GetMinX()); }