Files
2025-12-15 22:10:55 +08:00

129 lines
4.2 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 AnimDefStep7.cpp
Animation for Step 7
***********************************************************************************************************************/
// Do not define INITIALIZE_A3D_API here. It should be only included once in a project.
#include "AnimDef.hpp"
//######################################################################################################################
/*
Zoom out to extent and pause 1 second.
Then one by one bring each object back in.
*/
A3DStatus BuildAnimationStep7(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, 7,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION CAMERA
CreateMotionCameraInit(ppMotion, idxMotion,
121.631744, 65.543808, -3.716970,
30.948513, 27.898954, -16.392185,
-0.099281, -0.094375, 0.990579,
10, kA3DPDFOrthographicMode, 1.0/(2*28),
334.117035, 243.555069, 101.844193,
45.135365, 43.723457, -33.948994,
-0.311321, -0.183419, 0.932440,
10, kA3DPDFOrthographicMode, 1.0/(2*106),
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 1
// bring front casing back in (see Step 5)
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsCasingFront, idxTargetsCasingFront,
0.0, +80.0, 0.0, // init pos
0.0, -80.0, 0.0, // translation to apply
0.0, 1.0, 0.0, // color init
false, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 2
// bring housing front back in (see Step 4)
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsHousingFront, idxTargetsHousingFront,
+80.0, 0.0, 0.0, // init pos
-80.0, 0.0, 0.0, // translation to apply
54.0/255.0, 188.0/255.0, 252.0/255.0, // color init
false, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 3
// bring carbu back in (see Step 3)
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsCarbu, idxTargetsCarbu,
0.0, 0.0, -40.0, // init pos
0.0, 0.0, +40.0, // translation to apply
128.0/255.0, 255.0/255.0, 255.0/255.0, // color init
false, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 4
// bring the 4 screws back in (see Step 2)
//CreateMoveBackward to have the rotation with the movement
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsScrews, idxTargetsScrews,
-80.0, 0.0, 0.0, // init pos
+80.0, 0.0, 0.0, // translation to apply
1,0,0, // color init
false, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
dStepTimeDuration = dInitTimeOffset - dStepInitTimeOffset;
// --- ANIMATION CREATION
A3DPDFAnimationData sAnimationData;
A3D_INITIALIZE_DATA(A3DPDFAnimationData, sAnimationData);
sAnimationData.m_pcName = const_cast<A3DUTF8Char*>("step7");
sAnimationData.m_iFramesPerSecond = 20;
sAnimationData.m_iNumAnimationMotions = idxMotion;
sAnimationData.m_ppAnimationMotions = ppMotion;
iRet = A3DPDFAnimationCreate(&sAnimationData, ppAnim);
return iRet;
}