Files
Hoops_Exchange/publish/publishsource/AnimWorkinstruction/AnimDefStep5.cpp
2025-12-15 22:10:55 +08:00

104 lines
3.5 KiB
C++

/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
* scope and manner of such use.
*
***********************************************************************************************************************/
/**
\file AnimDefStep5.cpp
Animation for Step 5
***********************************************************************************************************************/
// Do not define INITIALIZE_A3D_API here. It should be only included once in a project.
#include "AnimDef.hpp"
//######################################################################################################################
/*
Orbit back to the front of the micro engine
Pause 1 second.
Change color of the pump jet from original color to yellow three times over one second.
Pause 0.5 seconds and then remove the casing
*/
A3DStatus BuildAnimationStep5(A3DPDFAnimation **ppAnim,
double dStepInitTimeOffset,
double& dStepTimeDuration)
{
A3DStatus iRet = A3D_SUCCESS;
// ANIMATION = set of MOTIONS
const int INBMOTIONS = 20;
A3DPDFAnimMotion** ppMotion;
ppMotion = (A3DPDFAnimMotion**) malloc(INBMOTIONS * A3DUns32(sizeof(A3DPDFAnimMotion*)));
int idxMotion = 0;
double dInitTimeOffset=dStepInitTimeOffset;
double dTimeDuration;
// MOTIONS to specify init state
CreateMotionsInitState(ppMotion, idxMotion, 5,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION CAMERA
CreateMotionCameraInit(ppMotion, idxMotion,
365.935852, 286.484344, 218.981415,
14.348255, 10.195333, -58.078251,
-0.390901, -0.354405, 0.849470,
10, kA3DPDFOrthographicMode, 1.0/(2*149),
407.025665, 316.211060, 244.481506,
17.669889, 10.242504, -62.340408,
-0.390901, -0.354405, 0.849471,
10, kA3DPDFOrthographicMode, 1.0/(2*164),
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 1
// Flash the color of pump jet to yellow three times over one second.
CreateMotionFlash(ppMotion, idxMotion,
ppTargetsCasingFront, idxTargetsCasingFront,
0.0, 1.0, 0.0, // color init
1,1,0, // color blink
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 2
// Pause 0.5 seconds and then remove the pump jet.
dInitTimeOffset += PAUSEDEMISEC;
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsCasingFront, idxTargetsCasingFront,
0.0, 0.0, 0.0, // init pos
0.0, +80.0, 0.0, // translation to apply
0.0, 1.0, 0.0, // color init
true, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
dStepTimeDuration = dInitTimeOffset - dStepInitTimeOffset;
// --- ANIMATION CREATION
A3DPDFAnimationData sAnimationData;
A3D_INITIALIZE_DATA(A3DPDFAnimationData, sAnimationData);
sAnimationData.m_pcName = const_cast<A3DUTF8Char*>("step5");
sAnimationData.m_iFramesPerSecond = 20;
sAnimationData.m_iNumAnimationMotions = idxMotion;
sAnimationData.m_ppAnimationMotions = ppMotion;
iRet = A3DPDFAnimationCreate(&sAnimationData, ppAnim);
return iRet;
}