Add publish
This commit is contained in:
189
publish/publishsource/AnimWorkinstruction/AnimDefStepInits.cpp
Normal file
189
publish/publishsource/AnimWorkinstruction/AnimDefStepInits.cpp
Normal file
@@ -0,0 +1,189 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* 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 AnimDefStepInits.cpp
|
||||
|
||||
Definition of motions for initial states of all animations (=steps here)
|
||||
***********************************************************************************************************************/
|
||||
|
||||
// Do not define INITIALIZE_A3D_API here. It should be only included once in a project.
|
||||
#include "AnimDef.hpp"
|
||||
|
||||
//######################################################################################################################
|
||||
|
||||
/*
|
||||
handling init states: we must be able to replay each step at any moment. This means that each step must start with the
|
||||
good init state, always restored. This init state is inherited from past steps.
|
||||
*/
|
||||
A3DStatus CreateMotionsInitState(A3DPDFAnimMotion**& ppMotion, int& idxMotion,
|
||||
int iMaxStep,
|
||||
double dStepInitTimeOffset,
|
||||
double& dStepTimeDuration)
|
||||
{
|
||||
A3DStatus iRet = A3D_SUCCESS;
|
||||
|
||||
double dInitTimeOffset=dStepInitTimeOffset;
|
||||
double dTimeDuration;
|
||||
|
||||
// MOTIONS to specify init state
|
||||
// Step 0 = all at init pos; all visible
|
||||
if(iMaxStep >= 1)
|
||||
{
|
||||
CreateMotionMoveInitTransfo(ppMotion, idxMotion,
|
||||
ppTargetsAllModel, idxTargetsAllModel,
|
||||
0.0, 0.0, 0.0, // translation to set to the matrix
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
|
||||
// reset opacity : all visibles
|
||||
CreateMotionAppearInit(ppMotion, idxMotion,
|
||||
ppTargetsAllModel, idxTargetsAllModel,
|
||||
-1,-1,-1, // color init
|
||||
1.0,
|
||||
kA3DPDFRenderingSolid,
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
|
||||
// reset washer color to initial color
|
||||
CreateMotionAppearInit(ppMotion, idxMotion,
|
||||
ppTargetsWasher, idxTargetsWasher,
|
||||
1, 1, 0, // color init
|
||||
-1,
|
||||
kA3DPDFRenderingSolid,
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
}
|
||||
|
||||
// MOTIONS to specify init state
|
||||
// End Step 1 = same ending state as init
|
||||
if(iMaxStep >= 2)
|
||||
{
|
||||
}
|
||||
|
||||
// End Step 2 = all screws translated and hidden
|
||||
if(iMaxStep >= 3)
|
||||
{
|
||||
CreateMotionMoveInitTransfo(ppMotion, idxMotion,
|
||||
ppTargetsScrews, idxTargetsScrews,
|
||||
-80.0, 0.0, 0.0, // translation to set to the matrix
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
|
||||
// reset opacity
|
||||
CreateMotionAppearInit(ppMotion, idxMotion,
|
||||
ppTargetsScrews, idxTargetsScrews,
|
||||
-1, -1, -1, // color init
|
||||
0.0,
|
||||
kA3DPDFRenderingSolid,
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
}
|
||||
|
||||
// End Step 3 = carbu translated and hidden
|
||||
if(iMaxStep >= 4)
|
||||
{
|
||||
CreateMotionMoveInitTransfo(ppMotion, idxMotion,
|
||||
ppTargetsCarbu, idxTargetsCarbu,
|
||||
0.0, 0.0, -40.0, // translation to set to the matrix
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
|
||||
// reset opacity
|
||||
CreateMotionAppearInit(ppMotion, idxMotion,
|
||||
ppTargetsCarbu, idxTargetsCarbu,
|
||||
-1, -1, -1, // color init
|
||||
0.0,
|
||||
kA3DPDFRenderingSolid,
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
}
|
||||
|
||||
// End Step 4 = hfront translated and hidden
|
||||
if(iMaxStep >= 5)
|
||||
{
|
||||
CreateMotionMoveInitTransfo(ppMotion, idxMotion,
|
||||
ppTargetsHousingFront, idxTargetsHousingFront,
|
||||
+80.0, 0.0, 0.0, // translation to set to the matrix
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
|
||||
// reset opacity
|
||||
CreateMotionAppearInit(ppMotion, idxMotion,
|
||||
ppTargetsHousingFront, idxTargetsHousingFront,
|
||||
-1, -1, -1, // color init
|
||||
0.0,
|
||||
kA3DPDFRenderingSolid,
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
}
|
||||
|
||||
// End Step 5 = casingfront translated and hidden
|
||||
if(iMaxStep >= 6)
|
||||
{
|
||||
CreateMotionMoveInitTransfo(ppMotion, idxMotion,
|
||||
ppTargetsCasingFront, idxTargetsCasingFront,
|
||||
0.0, +80.0, 0.0, // translation to set to the matrix
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
|
||||
// reset opacity
|
||||
CreateMotionAppearInit(ppMotion, idxMotion,
|
||||
ppTargetsCasingFront, idxTargetsCasingFront,
|
||||
-1, -1, -1, // color init
|
||||
0.0,
|
||||
kA3DPDFRenderingSolid,
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
}
|
||||
|
||||
// End Step 6 = washer replaced with new color
|
||||
if(iMaxStep >= 7)
|
||||
{
|
||||
// reset washer color to initial color
|
||||
CreateMotionAppearInit(ppMotion, idxMotion,
|
||||
ppTargetsWasher, idxTargetsWasher,
|
||||
1, 0, 1, // color init
|
||||
-1,
|
||||
kA3DPDFRenderingSolid,
|
||||
dInitTimeOffset,
|
||||
dTimeDuration);
|
||||
// DO NOT change the init time (we just want to define the initial state)
|
||||
//dInitTimeOffset += dTimeDuration;
|
||||
}
|
||||
|
||||
// we need to play all these motions simultaneously
|
||||
dStepTimeDuration = 0.5;
|
||||
//dStepTimeDuration = dInitTimeOffset - dStepInitTimeOffset;
|
||||
|
||||
return iRet;
|
||||
}
|
||||
Reference in New Issue
Block a user