void TerrainPicker::FindGroundPoint() { if (!m_pHeightField) return; FPoint3 pos, dir, result; vtGetScene()->CameraRay(m_pos, pos, dir); // test whether we hit the heightfield m_bOnTerrain = m_pHeightField->CastRayToSurface(pos, dir, result); if (!m_bOnTerrain) return; for (uint i = 0; i < NumTargets(); i++) { vtTransform *pTarget = (vtTransform *) GetTarget(i); pTarget->SetTrans(result); } // save result m_GroundPoint = result; // Find corresponding earth coordinates g_Conv.ConvertToEarth(m_GroundPoint, m_EarthPos); }
plMaxNodeBase *plComponentBase::GetTarget(uint32_t i) { if (fTargsPB && i < NumTargets()) return (plMaxNodeBase*)fTargsPB->GetINode(kTargs, 0, i); return nil; }
void plPhysBridgeComponent::ValidateSections() { int i; // Make sure everything we're attached to is in our list of sections for (i = 0; i < NumTargets(); i++) { INode* node = (INode*)GetTarget(i); bool found = false; int count = fCompPB->Count(kSections); for (int j = 0; j < count; j++) { if (node == fCompPB->GetINode(kSections, 0, j)) { found = true; break; } } if (!found) fCompPB->Append(kSections, 1, &node); } // Make sure we're still attached to everything in our list of sections for (i = fCompPB->Count(kSections)-1; i >= 0; i--) { plMaxNodeBase* node = (plMaxNodeBase*)fCompPB->GetINode(kSections, 0, i); if (!IsTarget(node)) fCompPB->Delete(kSections, i, 1); } }
void vtTimeEngine::_InformTarget() { for (uint i = 0; i < NumTargets(); i++) { vtTimeTarget* pTarget = (vtTimeTarget *)GetTarget(i); pTarget->SetTime(m_time); } }
Port::Status OutputPort::GetStatus() const { if (NumTargets() == 0) { return m_is_required ? Required : Disconnected; } return Ok; }
void plComponentBase::AddTargetsToList(INodeTab& list) { int i; for( i = 0; i < NumTargets(); i++ ) { INode* targ = GetTarget(i); if( targ ) list.Append(1, &targ); } }
void plDistribComponent_old::Preview() { if( !NumTargets() ) return; GetCOREInterface()->DisableSceneRedraw(); plDistribInstTab replicants; plExportProgressBar bar; bar.Start("Preview", NumTargets() << 4); plDistTree distTree; Distribute(replicants, bar, &distTree); IMakeOne(replicants); Done(); GetCOREInterface()->EnableSceneRedraw(); GetCOREInterface()->ForceCompleteRedraw(FALSE); }
BOOL plDistribComponent_old::Distribute(plDistribInstTab& replicants, plExportProgressBar& bar, plDistTree* distTree) { return false; BOOL retVal = true; GetCOREInterface()->DisableSceneRedraw(); Clear(); plDistributor distrib; distrib.SetTheInterface(GetCOREInterface()); distrib.SetSpacing(fCompPB->GetFloat(kSpacing)); distrib.SetSpacingRange(fCompPB->GetFloat(kRndPosRadius) * 0.01f * distrib.GetSpacing() * 0.5f); Point3 align(fCompPB->GetFloat(kAlignVecX), fCompPB->GetFloat(kAlignVecY), fCompPB->GetFloat(kAlignVecZ)); align.FNormalize(); distrib.SetAlignmentVec(align); distrib.SetAlignmentWeight(fCompPB->GetFloat(kAlignWgt)); distrib.SetPolarRange(fCompPB->GetFloat(kPolarRange)); distrib.SetAzimuthRange(fCompPB->GetFloat(kAzimuthRange)); distrib.SetOverallProb(fCompPB->GetFloat(kOverallProb)); distrib.SetPolarBunch(fCompPB->GetFloat(kPolarBunch)); Point3 scaleLo(fCompPB->GetFloat(kScaleLoX), fCompPB->GetFloat(kScaleLoY), fCompPB->GetFloat(kScaleLoZ)); Point3 scaleHi(fCompPB->GetFloat(kScaleHiX), fCompPB->GetFloat(kScaleHiY), fCompPB->GetFloat(kScaleHiZ)); distrib.SetScaleRange(scaleLo, scaleHi); ULONG scaleLock = plDistributor::kLockNone; if( fCompPB->GetInt(kLockScaleXYZ) ) scaleLock = plDistributor::kLockX | plDistributor::kLockY | plDistributor::kLockZ; else if( fCompPB->GetInt(kLockScaleXY) ) scaleLock = plDistributor::kLockX | plDistributor::kLockY; distrib.SetScaleLock(scaleLock); distrib.SetProbabilityChan(kProbColorChanStrings[fCompPB->GetInt(kProbColorChan)].fValue); ISetProbTexmap(distrib); // Setup the new params here. FISH... Point3 probVec(fCompPB->GetFloat(kAngProbX), fCompPB->GetFloat(kAngProbY), fCompPB->GetFloat(kAngProbZ)); distrib.SetAngleProbVec(probVec); distrib.SetAngleProbHi(fCompPB->GetFloat(kAngProbHi)); distrib.SetAngleProbLo(fCompPB->GetFloat(kAngProbLo)); distrib.SetProbabilityRemapFromLo(fCompPB->GetFloat(kRemapFromLo)); distrib.SetProbabilityRemapFromHi(fCompPB->GetFloat(kRemapFromHi)); distrib.SetProbabilityRemapToLo(fCompPB->GetFloat(kRemapToLo)); distrib.SetProbabilityRemapToHi(fCompPB->GetFloat(kRemapToHi)); if( !fCompPB->GetInt(kSeedLocked) ) fCompPB->SetValue(kSeed, TimeValue(0), fCompPB->GetInt(kNextSeed)); distrib.SetRandSeed(fCompPB->GetInt(kSeed)); distrib.SetFade(GetFade()); if( fCompPB->GetInt(kWindBoneActive) ) distrib.SetBone(fCompPB->GetINode(kWindBone)); distrib.SetRigid(!IsFlexible()); // FISH HACK, get this passed in from Cluster distrib.SetDistTree(distTree); distrib.SetIsolation(GetIsolation()); int numReps = fCompPB->Count(kTemplates); int i; for( i = 0; i < numReps; i++ ) { INode* temp = fCompPB->GetINode(kTemplates, TimeValue(0), i); if( temp ) distrib.AddReplicateNode(temp); } int numTarg = NumTargets(); for( i = 0; i < numTarg; i++ ) { if( GetTarget(i) ) { if( !distrib.Distribute(GetTarget(i), replicants, fDistCache, bar) ) { retVal = false; break; } } } fCompPB->SetValue(kNextSeed, TimeValue(0), int(distrib.GetRandSeed())); BOOL redrawDissed = GetCOREInterface()->IsSceneRedrawDisabled(); GetCOREInterface()->EnableSceneRedraw(); GetCOREInterface()->ForceCompleteRedraw(FALSE); return retVal; }