⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modelbuilder.cpp

📁 骨骼动画....把魔兽模型解出的代码..
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	Node.Time = Time;
	Node.Vector.x = static_cast<FLOAT>(Vector.X);
	Node.Vector.y = static_cast<FLOAT>(Vector.Y);
	Node.InTan.x = static_cast<FLOAT>(InTan.X);
	Node.InTan.y = static_cast<FLOAT>(InTan.Y);
	Node.OutTan.x = static_cast<FLOAT>(OutTan.X);
	Node.OutTan.y = static_cast<FLOAT>(OutTan.Y);

	CurrentInterpolator.AddNode(Node);
}


//+-----------------------------------------------------------------------------
//| Adds a 3-dimensional vector to the interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::AddVector3(INT Time, CONST WAR3_MODEL_VECTOR_3& Vector, CONST WAR3_MODEL_VECTOR_3& InTan, CONST WAR3_MODEL_VECTOR_3& OutTan)
{
	INTERPOLATOR_NODE Node;

	Node.Time = Time;
	Node.Vector.x = static_cast<FLOAT>(Vector.X);
	Node.Vector.y = static_cast<FLOAT>(Vector.Y);
	Node.Vector.z = static_cast<FLOAT>(Vector.Z);
	Node.InTan.x = static_cast<FLOAT>(InTan.X);
	Node.InTan.y = static_cast<FLOAT>(InTan.Y);
	Node.InTan.z = static_cast<FLOAT>(InTan.Z);
	Node.OutTan.x = static_cast<FLOAT>(OutTan.X);
	Node.OutTan.y = static_cast<FLOAT>(OutTan.Y);
	Node.OutTan.z = static_cast<FLOAT>(OutTan.Z);

	CurrentInterpolator.AddNode(Node);
}


//+-----------------------------------------------------------------------------
//| Adds a 4-dimensional vector to the interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::AddVector4(INT Time, CONST WAR3_MODEL_VECTOR_4& Vector, CONST WAR3_MODEL_VECTOR_4& InTan, CONST WAR3_MODEL_VECTOR_4& OutTan)
{
	INTERPOLATOR_NODE Node;

	Node.Time = Time;
	Node.Vector.x = static_cast<FLOAT>(Vector.X);
	Node.Vector.y = static_cast<FLOAT>(Vector.Y);
	Node.Vector.z = static_cast<FLOAT>(Vector.Z);
	Node.Vector.w = static_cast<FLOAT>(Vector.W);
	Node.InTan.x = static_cast<FLOAT>(InTan.X);
	Node.InTan.y = static_cast<FLOAT>(InTan.Y);
	Node.InTan.z = static_cast<FLOAT>(InTan.Z);
	Node.InTan.w = static_cast<FLOAT>(InTan.W);
	Node.OutTan.x = static_cast<FLOAT>(OutTan.X);
	Node.OutTan.y = static_cast<FLOAT>(OutTan.Y);
	Node.OutTan.z = static_cast<FLOAT>(OutTan.Z);
	Node.OutTan.w = static_cast<FLOAT>(OutTan.W);

	CurrentInterpolator.AddNode(Node);
}


//+-----------------------------------------------------------------------------
//| Sets the translation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedAttachmentTranslation(INT AttachmentId)
{
	MODEL_ATTACHMENT* ModelAttachment;

	if(!Model.Data().AttachmentContainer.ValidIndex(AttachmentId)) return;
	ModelAttachment = Model.Data().AttachmentContainer[AttachmentId];

	ModelAttachment->Data().Translation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the rotation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedAttachmentRotation(INT AttachmentId)
{
	MODEL_ATTACHMENT* ModelAttachment;

	if(!Model.Data().AttachmentContainer.ValidIndex(AttachmentId)) return;
	ModelAttachment = Model.Data().AttachmentContainer[AttachmentId];

	ModelAttachment->Data().Rotation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the scaling to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedAttachmentScaling(INT AttachmentId)
{
	MODEL_ATTACHMENT* ModelAttachment;

	if(!Model.Data().AttachmentContainer.ValidIndex(AttachmentId)) return;
	ModelAttachment = Model.Data().AttachmentContainer[AttachmentId];

	ModelAttachment->Data().Scaling = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the visibility to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedAttachmentVisibility(INT AttachmentId)
{
	MODEL_ATTACHMENT* ModelAttachment;

	if(!Model.Data().AttachmentContainer.ValidIndex(AttachmentId)) return;
	ModelAttachment = Model.Data().AttachmentContainer[AttachmentId];

	ModelAttachment->Data().Visibility = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the translation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedBoneTranslation(INT BoneId)
{
	MODEL_BONE* ModelBone;

	if(!Model.Data().BoneContainer.ValidIndex(BoneId)) return;
	ModelBone = Model.Data().BoneContainer[BoneId];

	ModelBone->Data().Translation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the rotation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedBoneRotation(INT BoneId)
{
	MODEL_BONE* ModelBone;

	if(!Model.Data().BoneContainer.ValidIndex(BoneId)) return;
	ModelBone = Model.Data().BoneContainer[BoneId];

	ModelBone->Data().Rotation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the scaling to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedBoneScaling(INT BoneId)
{
	MODEL_BONE* ModelBone;

	if(!Model.Data().BoneContainer.ValidIndex(BoneId)) return;
	ModelBone = Model.Data().BoneContainer[BoneId];

	ModelBone->Data().Scaling = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the translation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedCollisionShapeTranslation(INT CollisionShapeId)
{
	MODEL_COLLISION_SHAPE* ModelCollisionShape;

	if(!Model.Data().CollisionShapeContainer.ValidIndex(CollisionShapeId)) return;
	ModelCollisionShape = Model.Data().CollisionShapeContainer[CollisionShapeId];

	ModelCollisionShape->Data().Translation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the rotation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedCollisionShapeRotation(INT CollisionShapeId)
{
	MODEL_COLLISION_SHAPE* ModelCollisionShape;

	if(!Model.Data().CollisionShapeContainer.ValidIndex(CollisionShapeId)) return;
	ModelCollisionShape = Model.Data().CollisionShapeContainer[CollisionShapeId];

	ModelCollisionShape->Data().Rotation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the scaling to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedCollisionShapeScaling(INT CollisionShapeId)
{
	MODEL_COLLISION_SHAPE* ModelCollisionShape;

	if(!Model.Data().CollisionShapeContainer.ValidIndex(CollisionShapeId)) return;
	ModelCollisionShape = Model.Data().CollisionShapeContainer[CollisionShapeId];

	ModelCollisionShape->Data().Scaling = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the translation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedEventObjectTranslation(INT EventObjectId)
{
	MODEL_EVENT_OBJECT* ModelEventObject;

	if(!Model.Data().EventObjectContainer.ValidIndex(EventObjectId)) return;
	ModelEventObject = Model.Data().EventObjectContainer[EventObjectId];

	ModelEventObject->Data().Translation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the rotation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedEventObjectRotation(INT EventObjectId)
{
	MODEL_EVENT_OBJECT* ModelEventObject;

	if(!Model.Data().EventObjectContainer.ValidIndex(EventObjectId)) return;
	ModelEventObject = Model.Data().EventObjectContainer[EventObjectId];

	ModelEventObject->Data().Rotation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the scaling to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedEventObjectScaling(INT EventObjectId)
{
	MODEL_EVENT_OBJECT* ModelEventObject;

	if(!Model.Data().EventObjectContainer.ValidIndex(EventObjectId)) return;
	ModelEventObject = Model.Data().EventObjectContainer[EventObjectId];

	ModelEventObject->Data().Scaling = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the translation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedHelperTranslation(INT HelperId)
{
	MODEL_HELPER* ModelHelper;

	if(!Model.Data().HelperContainer.ValidIndex(HelperId)) return;
	ModelHelper = Model.Data().HelperContainer[HelperId];

	ModelHelper->Data().Translation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the rotation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedHelperRotation(INT HelperId)
{
	MODEL_HELPER* ModelHelper;

	if(!Model.Data().HelperContainer.ValidIndex(HelperId)) return;
	ModelHelper = Model.Data().HelperContainer[HelperId];

	ModelHelper->Data().Rotation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the scaling to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedHelperScaling(INT HelperId)
{
	MODEL_HELPER* ModelHelper;

	if(!Model.Data().HelperContainer.ValidIndex(HelperId)) return;
	ModelHelper = Model.Data().HelperContainer[HelperId];

	ModelHelper->Data().Scaling = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the translation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedLightTranslation(INT LightId)
{
	MODEL_LIGHT* ModelLight;

	if(!Model.Data().LightContainer.ValidIndex(LightId)) return;
	ModelLight = Model.Data().LightContainer[LightId];

	ModelLight->Data().Translation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the rotation to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedLightRotation(INT LightId)
{
	MODEL_LIGHT* ModelLight;

	if(!Model.Data().LightContainer.ValidIndex(LightId)) return;
	ModelLight = Model.Data().LightContainer[LightId];

	ModelLight->Data().Rotation = CurrentInterpolator;
}


//+-----------------------------------------------------------------------------
//| Sets the scaling to the last created interpolator
//+-----------------------------------------------------------------------------
VOID MODEL_BUILDER::SetAnimatedLightScaling(INT LightId)
{
	MODEL_LIGHT* ModelLight;

	if(!Model.Data().LightContainer.ValidIndex(LightId)) return;
	ModelLight = Model.Data().LightContainer[LightId];

	ModelLight->Data().Scaling = CurrentInterpolator;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -