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

158 lines
9.3 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 AnimDefTargets.cpp
Shared definition of all different set of targets used in all animations
***********************************************************************************************************************/
// Do not define INITIALIZE_A3D_API here. It should be only included once in a project.
#define DEFINE_TARGETS_GLOBALS
#include "AnimDef.hpp"
//######################################################################################################################
A3DStatus AddTarget(A3DPDFTargetEntity**& ppTargets, int& idxTarget,
A3DAsmModelFile* pModelFile, A3DUTF8Char *pcName, int iIndexRepItem)
{
A3DPDFTargetEntity*** ppTargetEntities;
A3DInt32 *piSizes;
A3DUTF8Char *apcNames[1];
apcNames[0] = pcName;
A3DInt32 aiIndexes[1];
aiIndexes[0] = iIndexRepItem;
A3DPDFGetEntitiesFromName(pModelFile, (A3DInt32)1, apcNames, aiIndexes, &ppTargetEntities, &piSizes);
if (piSizes==0)
return A3D_ERROR;
if (ppTargetEntities[0] != NULL)
ppTargets[idxTarget++]=ppTargetEntities[0][0];
else
return A3D_ERROR;
return A3D_SUCCESS;
}
void CreateAllTargetsSet(A3DAsmModelFile* pModelFile)
{
// --- TARGETS SET - All but earing PR DW
const int INBTARGETSALLOC = 25;
ppTargetsAllExceptWasher = (A3DPDFTargetEntity**) malloc(INBTARGETSALLOC * A3DUns32(sizeof(A3DPDFTargetEntity*)));
memset(ppTargetsAllExceptWasher, 0, sizeof(A3DPDFTargetEntity*) * INBTARGETSALLOC);
idxTargetsAllExceptWasher=0;
// we specify 0 as index to get the first son of the productoccurence entity specified by its name
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "HOUSING(HOUSING.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "CYLINDER LINER(CYLINDER LINER.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "HOUSING TOP(HOUSING TOP.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "PUSH ROD(PUSH ROD.1)", 0);
//AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "BEARING PR DW(BEARING PR DW.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "BEARING PR UP(BEARING PR UP.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "AXE(AXE.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "PISTON(PISTON.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "CRANKSHAFT(CRANKSHAFT.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "BEARING CS(BEARING CS.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "HOUSING BACK(HOUSING BACK.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "HOUSING FRONT(HOUSING FRONT.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "SCREW BACK(SCREW BACK.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "SCREW BACK(SCREW BACK.2)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "SCREW BACK(SCREW BACK.3)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "SCREW BACK(SCREW BACK.4)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "SCREW TOP(SCREW TOP.1)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "SCREW TOP(SCREW TOP.2)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "SCREW TOP(SCREW TOP.3)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "SCREW TOP(SCREW TOP.4)", 0);
AddTarget(ppTargetsAllExceptWasher, idxTargetsAllExceptWasher, pModelFile, "CARBURETOR(CARBURETOR.1)", 0);
// --- TARGETS - ALL THE MODEL
ppTargetsAllModel = (A3DPDFTargetEntity**) malloc(INBTARGETSALLOC * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsAllModel=0;
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "HOUSING(HOUSING.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "CYLINDER LINER(CYLINDER LINER.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "HOUSING TOP(HOUSING TOP.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "PUSH ROD(PUSH ROD.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "BEARING PR DW(BEARING PR DW.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "BEARING PR UP(BEARING PR UP.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "AXE(AXE.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "PISTON(PISTON.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "CRANKSHAFT(CRANKSHAFT.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "BEARING CS(BEARING CS.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "HOUSING BACK(HOUSING BACK.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "HOUSING FRONT(HOUSING FRONT.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "SCREW BACK(SCREW BACK.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "SCREW BACK(SCREW BACK.2)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "SCREW BACK(SCREW BACK.3)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "SCREW BACK(SCREW BACK.4)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "SCREW TOP(SCREW TOP.1)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "SCREW TOP(SCREW TOP.2)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "SCREW TOP(SCREW TOP.3)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "SCREW TOP(SCREW TOP.4)", 0);
AddTarget(ppTargetsAllModel, idxTargetsAllModel, pModelFile, "CARBURETOR(CARBURETOR.1)", 0);
// --- TARGETS SET - just the washer
ppTargetsWasher = (A3DPDFTargetEntity**) malloc(1 * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsWasher=0;
AddTarget(ppTargetsWasher, idxTargetsWasher, pModelFile, "BEARING PR DW(BEARING PR DW.1)", 0);
// --- TARGETS SET - screw1
ppTargetsScrew1 = (A3DPDFTargetEntity**) malloc(1 * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsScrew1=0;
AddTarget(ppTargetsScrew1, idxTargetsScrew1, pModelFile, "SCREW BACK(SCREW BACK.1)", 0);
// --- TARGETS SET - screw2To4
ppTargetsScrew2To4 = (A3DPDFTargetEntity**) malloc(3 * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsScrew2To4=0;
AddTarget(ppTargetsScrew2To4, idxTargetsScrew2To4, pModelFile, "SCREW BACK(SCREW BACK.2)", 0);
AddTarget(ppTargetsScrew2To4, idxTargetsScrew2To4, pModelFile, "SCREW BACK(SCREW BACK.3)", 0);
AddTarget(ppTargetsScrew2To4, idxTargetsScrew2To4, pModelFile, "SCREW BACK(SCREW BACK.4)", 0);
// --- TARGETS SET - carbu
ppTargetsCarbu = (A3DPDFTargetEntity**) malloc(1 * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsCarbu=0;
AddTarget(ppTargetsCarbu, idxTargetsCarbu, pModelFile, "CARBURETOR(CARBURETOR.1)", 0);
// --- TARGETS SET - housing front
ppTargetsHousingFront = (A3DPDFTargetEntity**) malloc(1 * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsHousingFront=0;
AddTarget(ppTargetsHousingFront, idxTargetsHousingFront, pModelFile, "HOUSING FRONT(HOUSING FRONT.1)", 0);
// --- TARGETS SET - front casing
ppTargetsCasingFront = (A3DPDFTargetEntity**) malloc(2 * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsCasingFront=0;
AddTarget(ppTargetsCasingFront, idxTargetsCasingFront, pModelFile, "CRANKSHAFT(CRANKSHAFT.1)", 0); // Casing front - crankshaft-
AddTarget(ppTargetsCasingFront, idxTargetsCasingFront, pModelFile, "BEARING CS(BEARING CS.1)", 0); // Casing front - bearing cs
// --- TARGETS SET - the 4 screws
ppTargetsScrews = (A3DPDFTargetEntity**) malloc(4 * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsScrews=0;
AddTarget(ppTargetsScrews, idxTargetsScrews, pModelFile, "SCREW BACK(SCREW BACK.1)", 0);
AddTarget(ppTargetsScrews, idxTargetsScrews, pModelFile, "SCREW BACK(SCREW BACK.2)", 0);
AddTarget(ppTargetsScrews, idxTargetsScrews, pModelFile, "SCREW BACK(SCREW BACK.3)", 0);
AddTarget(ppTargetsScrews, idxTargetsScrews, pModelFile, "SCREW BACK(SCREW BACK.4)", 0);
// --- TARGETS SET - subasm mobile part
ppTargetsMobilePart = (A3DPDFTargetEntity**) malloc(1 * A3DUns32(sizeof(A3DPDFTargetEntity*)));
idxTargetsMobilePart=0;
// we specify -1 as index to get the productoccurence entity
AddTarget(ppTargetsMobilePart, idxTargetsMobilePart, pModelFile, "MOBILE PART(MOBILE PART.1)", -1);
}