VariantVector CrowdManager::GetObstacleAvoidanceTypesAttr() const { VariantVector ret; if (crowd_) { ret.Reserve(numObstacleAvoidanceTypes_ * 10 + 1); ret.Push(numObstacleAvoidanceTypes_); for (unsigned i = 0; i < numObstacleAvoidanceTypes_; ++i) { const dtObstacleAvoidanceParams* params = crowd_->getObstacleAvoidanceParams(i); assert(params); ret.Push(params->velBias); ret.Push(params->weightDesVel); ret.Push(params->weightCurVel); ret.Push(params->weightSide); ret.Push(params->weightToi); ret.Push(params->horizTime); ret.Push(params->gridSize); ret.Push(params->adaptiveDivs); ret.Push(params->adaptiveRings); ret.Push(params->adaptiveDepth); } } else ret.Push(0); return ret; }
VariantVector CrowdManager::GetQueryFilterTypesAttr() const { VariantVector ret; if (crowd_) { unsigned totalNumAreas = 0; for (unsigned i = 0; i < numQueryFilterTypes_; ++i) totalNumAreas += numAreas_[i]; ret.Reserve(numQueryFilterTypes_ * 3 + totalNumAreas + 1); ret.Push(numQueryFilterTypes_); for (unsigned i = 0; i < numQueryFilterTypes_; ++i) { const dtQueryFilter* filter = crowd_->getFilter(i); assert(filter); ret.Push(filter->getIncludeFlags()); ret.Push(filter->getExcludeFlags()); ret.Push(numAreas_[i]); for (unsigned j = 0; j < numAreas_[i]; ++j) ret.Push(filter->getAreaCost(j)); } } else ret.Push(0); return ret; }
VariantVector ParticleEmitter::GetParticleBillboardsAttr() const { VariantVector ret; if (!serializeParticles_) { ret.Push(billboards_.Size()); return ret; } ret.Reserve(billboards_.Size() * 7 + 1); ret.Push(billboards_.Size()); for (PODVector<Billboard>::ConstIterator i = billboards_.Begin(); i != billboards_.End(); ++i) { ret.Push(i->position_); ret.Push(i->size_); ret.Push(Vector4(i->uv_.min_.x_, i->uv_.min_.y_, i->uv_.max_.x_, i->uv_.max_.y_)); ret.Push(i->color_); ret.Push(i->rotation_); ret.Push(i->direction_); ret.Push(i->enabled_); } return ret; }
VariantVector AnimatedModel::GetBonesEnabledAttr() const { VariantVector ret; const Vector<Bone>& bones = skeleton_.GetBones(); ret.Reserve(bones.Size()); for (Vector<Bone>::ConstIterator i = bones.Begin(); i != bones.End(); ++i) ret.Push(i->animated_); return ret; }
VariantVector ParticleEmitter::GetTextureFramesAttr() const { VariantVector ret; ret.Reserve(textureFrames_.Size() * 2 + 1); ret.Push(textureFrames_.Size()); for (Vector<TextureFrame>::ConstIterator i = textureFrames_.Begin(); i < textureFrames_.End(); ++i) { ret.Push(i->uv_.ToVector4()); ret.Push(i->time_); } return ret; }
VariantVector ParticleEmitter::GetColorsAttr() const { VariantVector ret; ret.Reserve(colorFrames_.Size() * 2 + 1); ret.Push(colorFrames_.Size()); for (Vector<ColorFrame>::ConstIterator i = colorFrames_.Begin(); i < colorFrames_.End(); ++i) { ret.Push(i->color_); ret.Push(i->time_); } return ret; }
VariantVector AnimationController::GetAnimationsAttr() const { VariantVector ret; ret.Reserve(animations_.Size() * 5); for (Vector<AnimationControl>::ConstIterator i = animations_.Begin(); i != animations_.End(); ++i) { ret.Push(i->name_); ret.Push(i->speed_); ret.Push(i->targetWeight_); ret.Push(i->fadeTime_); ret.Push(i->autoFadeTime_); } return ret; }
VariantVector AnimationController::GetNodeAnimationStatesAttr() const { VariantVector ret; ret.Reserve(nodeAnimationStates_.Size() * 3 + 1); ret.Push(nodeAnimationStates_.Size()); for (Vector<SharedPtr<AnimationState> >::ConstIterator i = nodeAnimationStates_.Begin(); i != nodeAnimationStates_.End(); ++i) { AnimationState* state = *i; Animation* animation = state->GetAnimation(); ret.Push(GetResourceRef(animation, Animation::GetTypeStatic())); ret.Push(state->IsLooped()); ret.Push(state->GetTime()); } return ret; }
VariantVector ParticleEmitter::GetParticlesAttr() const { VariantVector ret; ret.Reserve(particles_.Size() * 8 + 1); ret.Push(particles_.Size()); for (PODVector<Particle>::ConstIterator i = particles_.Begin(); i != particles_.End(); ++i) { ret.Push(i->velocity_); ret.Push(i->size_); ret.Push(i->timer_); ret.Push(i->timeToLive_); ret.Push(i->scale_); ret.Push(i->rotationSpeed_); ret.Push(i->colorIndex_); ret.Push(i->texIndex_); } return ret; }
VariantVector BillboardSet::GetBillboardsAttr() const { VariantVector ret; ret.Reserve(billboards_.Size() * 6 + 1); ret.Push(billboards_.Size()); for (PODVector<Billboard>::ConstIterator i = billboards_.Begin(); i != billboards_.End(); ++i) { ret.Push(i->position_); ret.Push(i->size_); ret.Push(Vector4(i->uv_.min_.x_, i->uv_.min_.y_, i->uv_.max_.x_, i->uv_.max_.y_)); ret.Push(i->color_); ret.Push(i->rotation_); ret.Push(i->enabled_); } return ret; }
VariantVector AnimatedModel::GetAnimationStatesAttr() const { VariantVector ret; ret.Reserve(animationStates_.Size() * 6 + 1); ret.Push(animationStates_.Size()); for (Vector<SharedPtr<AnimationState> >::ConstIterator i = animationStates_.Begin(); i != animationStates_.End(); ++i) { AnimationState* state = *i; Animation* animation = state->GetAnimation(); Bone* startBone = state->GetStartBone(); ret.Push(GetResourceRef(animation, Animation::GetTypeStatic())); ret.Push(startBone ? startBone->name_ : String::EMPTY); ret.Push(state->IsLooped()); ret.Push(state->GetWeight()); ret.Push(state->GetTime()); ret.Push((int)state->GetLayer()); } return ret; }
VariantVector RaycastVehicle::GetWheelDataAttr() const { VariantVector ret; ret.Reserve(GetNumWheels() * 22 + 1); ret.Push(GetNumWheels()); for (int i = 0; i < GetNumWheels(); i++) { Node* wNode = GetWheelNode(i); int node_id = wNode->GetID(); URHO3D_LOGDEBUG("RaycastVehicle: Saving node id = " + String(node_id)); ret.Push(node_id); ret.Push(GetWheelDirection(i)); ret.Push(GetWheelAxle(i)); ret.Push(GetWheelRestLength(i)); ret.Push(GetWheelRadius(i)); ret.Push(IsFrontWheel(i)); ret.Push(GetSteeringValue(i)); ret.Push(GetWheelConnectionPoint(i)); ret.Push(origRotation_[i]); ret.Push(GetWheelSkidInfoCumulative(i)); ret.Push(GetWheelSideSlipSpeed(i)); ret.Push(WheelIsGrounded(i)); ret.Push(GetContactPosition(i)); ret.Push(GetContactNormal(i)); // 14 ret.Push(GetWheelSuspensionStiffness(i)); ret.Push(GetWheelDampingRelaxation(i)); ret.Push(GetWheelDampingCompression(i)); ret.Push(GetWheelFrictionSlip(i)); ret.Push(GetWheelRollInfluence(i)); ret.Push(GetEngineForce(i)); ret.Push(GetBrake(i)); ret.Push(GetWheelSkidInfo(i)); } URHO3D_LOGDEBUG("RaycastVehicle: saved items: " + String(ret.Size())); URHO3D_LOGDEBUG("maxSideSlipSpeed_ value save: " + String(maxSideSlipSpeed_)); return ret; }