This commit is contained in:
ninja
2025-12-15 22:06:49 +08:00
commit 2b56cf87a8
225 changed files with 63711 additions and 0 deletions

View File

@@ -0,0 +1,651 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateModelFile.cpp
* This file is containing the data and function used to create PRC Model file.
*
***********************************************************************************************************************/
#include "CreateModelFile.h"
#include "CreateTessellatedCubes.h"
#include "modules/CreateMarkups.h"
#include "modules/CreateTextures.h"
#include "modules/CreateViews.h"
#include <cstdlib>
#include <string>
#include <vector>
//######################################################################################################################
A3DStatus createCubeTessellation(A3DTess3D** ppTess3D, A3DUns32* puiStyleIndex)
{
A3DStatus iRet = A3D_SUCCESS;
// create a cube tessellation
A3DTess3DData sTess3DData;
fillCubeTessData(sTess3DData, puiStyleIndex);
CHECK_RET(A3DTess3DCreate(&sTess3DData, ppTess3D));
freeTess3DData(sTess3DData);
A3DTessBaseData sTessBaseData;
fillCubeTessBaseData(sTessBaseData, CUBE_WIDTH, CUBE_HEIGHT, CUBE_LENGTH);
CHECK_RET(A3DTessBaseSet(*ppTess3D, &sTessBaseData));
freeTessBaseData(sTessBaseData);
return iRet;
}
//######################################################################################################################
A3DStatus createPolyBREPModel(A3DRiPolyBrepModel** ppPolyBREP, A3DTess3D* pTess3D)
{
A3DStatus iRet = A3D_SUCCESS;
A3DRiPolyBrepModelData sPolyBrepModelData;
A3D_INITIALIZE_DATA(A3DRiPolyBrepModelData, sPolyBrepModelData);
sPolyBrepModelData.m_bIsClosed = TRUE;
CHECK_RET(A3DRiPolyBrepModelCreate(&sPolyBrepModelData, ppPolyBREP));
// assign the cube tessellation to the PolyBrepModel
A3DRiRepresentationItemData sRiData;
A3D_INITIALIZE_DATA(A3DRiRepresentationItemData, sRiData);
sRiData.m_pTessBase = pTess3D;
sRiData.m_pCoordinateSystem = NULL;
CHECK_RET(A3DRiRepresentationItemSet(*ppPolyBREP, &sRiData));
return iRet;
}
A3DStatus createPart(A3DAsmPartDefinition** ppPartDef, A3DRiRepresentationItem** ppRIs, A3DUns32 uiRepItemsSize)
{
A3DStatus iRet = A3D_SUCCESS;
A3DAsmPartDefinitionData sPartDefinitionData;
A3D_INITIALIZE_DATA(A3DAsmPartDefinitionData, sPartDefinitionData);
sPartDefinitionData.m_uiRepItemsSize = uiRepItemsSize;
sPartDefinitionData.m_ppRepItems = ppRIs;
sPartDefinitionData.m_uiAnnotationsSize = 0;
CHECK_RET(A3DAsmPartDefinitionCreate(&sPartDefinitionData, ppPartDef));
return iRet;
}
//######################################################################################################################
// Create uiPrototypesSize prototypes of the instance PO pInstance.
A3DStatus createAssemblyTree(A3DAsmProductOccurrence* pInstance, A3DUns32 uiPrototypesSize, A3DAsmProductOccurrence*** pppPrototypes)
{
A3DStatus iRet = A3D_SUCCESS;
A3DAsmProductOccurrence** ppPrototypes = new A3DAsmProductOccurrence*[uiPrototypesSize];
*pppPrototypes = ppPrototypes;
setEntityName(pInstance, "Instance");
A3DMiscAttribute* pAttribute = 0;
A3DMiscAttributeData sAttributeData;
A3D_INITIALIZE_DATA(A3DMiscAttributeData, sAttributeData);
sAttributeData.m_pcTitle = (A3DUTF8Char *)"Instance PO, holding data.";
CHECK_RET(A3DMiscAttributeCreate(&sAttributeData, &pAttribute));
addEntityAttributes(pInstance, 1, &pAttribute);
A3DEntityDelete(pAttribute);
// New PO with prototype
A3DAsmProductOccurrenceData sPrototypePOData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sPrototypePOData);
sPrototypePOData.m_pPrototype = pInstance; // populating the PO Data Structure with the prototype
for (A3DUns32 i = 0; i < uiPrototypesSize; ++i)
{
if (i > 0)
{
// create new location (color can also be modify)
A3DMiscCartesianTransformation* newLocation = NULL;
A3DMiscCartesianTransformationData newLocationData;
A3D_INITIALIZE_DATA(A3DMiscCartesianTransformationData, newLocationData);
newLocationData.m_sOrigin.m_dX = i * CUBE_SPACING;
newLocationData.m_sOrigin.m_dY = i * CUBE_SPACING;
newLocationData.m_sOrigin.m_dZ = i * CUBE_SPACING;
newLocationData.m_sScale.m_dX = 1;
newLocationData.m_sScale.m_dY = 1;
newLocationData.m_sScale.m_dZ = 1;
newLocationData.m_sXVector.m_dX = 1.0;
newLocationData.m_sXVector.m_dY = 0.0;
newLocationData.m_sXVector.m_dZ = 0.0;
newLocationData.m_sYVector.m_dX = 0.0;
newLocationData.m_sYVector.m_dY = 1.0;
newLocationData.m_sYVector.m_dZ = 0.0;
newLocationData.m_ucBehaviour = kA3DTransformationTranslate | kA3DTransformationRotate;
A3DMiscCartesianTransformationCreate(&newLocationData, &newLocation);
// populating the PO Data Structure with the location
sPrototypePOData.m_pLocation = newLocation;
}
// create PO from PO Data structure
A3DAsmProductOccurrenceCreate(&sPrototypePOData, &ppPrototypes[i]);
// add Base Info to enable graphics behaviors.
A3DRootBaseData sBaseData;
A3D_INITIALIZE_DATA(A3DRootBaseData, sBaseData);
CHECK_RET(A3DRootBaseSet(ppPrototypes[i], &sBaseData));
// sample name
CHECK_RET(setEntityName(ppPrototypes[i], "Prototype"));
// sample attribute
A3DMiscAttribute* pProtoAttribute=nullptr;
A3DMiscAttributeData sProtoAttributeData;
A3D_INITIALIZE_DATA(A3DMiscAttributeData, sProtoAttributeData);
sProtoAttributeData.m_pcTitle = (A3DUTF8Char *)"Prototype PO to an instance PO.";
CHECK_RET(A3DMiscAttributeCreate(&sProtoAttributeData, &pProtoAttribute));
CHECK_RET(addEntityAttributes(ppPrototypes[i], 1, &pProtoAttribute));
A3DEntityDelete(pProtoAttribute);
}
// we set the last cube blue, redefining the texture graphics
setEntityColor(ppPrototypes[uiPrototypesSize - 1], BLUE, 0.5);
return iRet;
}
//######################################################################################################################
A3DStatus createFileMarkups(A3DMkpAnnotationItem** ppOutAnnotationsSet,
A3DUns32 uiPrototypesSize, A3DAsmProductOccurrence** ppPrototypes,
A3DRiPolyBrepModel* pRiPolyBrepModel)
{
A3DStatus iRet = A3D_SUCCESS;
std::vector<A3DMkpAnnotationItem*> vpAnnotations;
A3DMkpAnnotationItem* pNewAnnotation = 0;
A3DAsmProductOccurrence* pCurrentPO = 0;
A3DUns32 uiPOCurrentIndex = 0;
// ------------------------------------------------------------------
// initialize markups position.
A3DVector3dData sAnnotationLeaderPos;
A3D_INITIALIZE_DATA(A3DVector3dData, sAnnotationLeaderPos);
A3DVector3dData sAnnotationLeaderPosOffset;
A3D_INITIALIZE_DATA(A3DVector3dData, sAnnotationLeaderPosOffset);
sAnnotationLeaderPosOffset.m_dX = 0;
sAnnotationLeaderPosOffset.m_dY = 0;
sAnnotationLeaderPosOffset.m_dZ = CUBE_HEIGHT;
A3DVector3dData sAnnotationFramePos;
A3D_INITIALIZE_DATA(A3DVector3dData, sAnnotationFramePos);
A3DVector3dData sAnnotationFramePosOffset;
A3D_INITIALIZE_DATA(A3DVector3dData, sAnnotationFramePosOffset);
sAnnotationFramePosOffset.m_dX = 1 * CUBE_WIDTH;
sAnnotationFramePosOffset.m_dY = 1 * CUBE_LENGTH;
sAnnotationFramePosOffset.m_dZ = 2 * CUBE_HEIGHT;
// ------------------------------------------------------------------
// simple markup
A3DUTF8Char *pcTextSimpleMarkup = (A3DUTF8Char *)"Simple";
pCurrentPO = ppPrototypes[uiPOCurrentIndex];
++uiPOCurrentIndex;
CHECK_RET(getPOLocationOrigin(pCurrentPO, &sAnnotationLeaderPos));
sAnnotationLeaderPos.m_dX += sAnnotationLeaderPosOffset.m_dX;
sAnnotationLeaderPos.m_dY += sAnnotationLeaderPosOffset.m_dY;
sAnnotationLeaderPos.m_dZ += sAnnotationLeaderPosOffset.m_dZ;
CHECK_RET(getPOLocationOrigin(pCurrentPO, &sAnnotationFramePos));
sAnnotationFramePos.m_dX += sAnnotationFramePosOffset.m_dX;
sAnnotationFramePos.m_dY += sAnnotationFramePosOffset.m_dY;
sAnnotationFramePos.m_dZ += sAnnotationFramePosOffset.m_dZ;
CHECK_RET(createMarkup(&pNewAnnotation,
pcTextSimpleMarkup,
1,
&pRiPolyBrepModel,
&pCurrentPO,
&sAnnotationFramePos,
&sAnnotationLeaderPos));
vpAnnotations.push_back(pNewAnnotation);
// ------------------------------------------------------------------
// Markup on a face
A3DUTF8Char *pcTextOnFace = (A3DUTF8Char *)"Face";
pCurrentPO = ppPrototypes[uiPOCurrentIndex];
++uiPOCurrentIndex;
CHECK_RET(getPOLocationOrigin(pCurrentPO, &sAnnotationLeaderPos));
sAnnotationLeaderPos.m_dX += sAnnotationLeaderPosOffset.m_dX;
sAnnotationLeaderPos.m_dY += sAnnotationLeaderPosOffset.m_dY;
sAnnotationLeaderPos.m_dZ += sAnnotationLeaderPosOffset.m_dZ;
CHECK_RET(getPOLocationOrigin(pCurrentPO, &sAnnotationFramePos));
sAnnotationFramePos.m_dX += sAnnotationFramePosOffset.m_dX;
sAnnotationFramePos.m_dY += sAnnotationFramePosOffset.m_dY;
sAnnotationFramePos.m_dZ += sAnnotationFramePosOffset.m_dZ;
A3DUns32 uiFaceIndex = 0;
CHECK_RET(createMarkupOnFace(&pNewAnnotation,
pcTextOnFace,
1,
&pRiPolyBrepModel,
&pCurrentPO,
&uiFaceIndex,
&sAnnotationFramePos,
&sAnnotationLeaderPos));
vpAnnotations.push_back(pNewAnnotation);
// ------------------------------------------------------------------
// Markup parrallel to screen
A3DUTF8Char *pcTextParallel = (A3DUTF8Char *)"Parallel";
pCurrentPO = ppPrototypes[uiPOCurrentIndex];
++uiPOCurrentIndex;
CHECK_RET(getPOLocationOrigin(pCurrentPO, &sAnnotationFramePos));
sAnnotationFramePos.m_dX += sAnnotationFramePosOffset.m_dX;
sAnnotationFramePos.m_dY += sAnnotationFramePosOffset.m_dY;
sAnnotationFramePos.m_dZ += sAnnotationFramePosOffset.m_dZ;
CHECK_RET(createMarkupFaceToScreen(&pNewAnnotation,
pcTextParallel,
1,
&pRiPolyBrepModel,
&pCurrentPO,
&sAnnotationFramePos));
vpAnnotations.push_back(pNewAnnotation);
// ------------------------------------------------------------------
// Markup non Zoomable
A3DUTF8Char *pcTextZoomable = (A3DUTF8Char *)"Non zoomable";
pCurrentPO = ppPrototypes[uiPOCurrentIndex];
++uiPOCurrentIndex;
CHECK_RET(getPOLocationOrigin(pCurrentPO, &sAnnotationFramePos));
sAnnotationFramePos.m_dX += sAnnotationFramePosOffset.m_dX;
sAnnotationFramePos.m_dY += sAnnotationFramePosOffset.m_dY;
sAnnotationFramePos.m_dZ += sAnnotationFramePosOffset.m_dZ;
CHECK_RET(createMarkupFaceToScreen(&pNewAnnotation,
pcTextZoomable,
1,
&pRiPolyBrepModel,
&pCurrentPO,
&sAnnotationFramePos,
FlatToScreenNonZoomable));
vpAnnotations.push_back(pNewAnnotation);
// ------------------------------------------------------------------
// Markup non Zoomable
A3DUTF8Char *pcTextAttached = (A3DUTF8Char *)"OnTop";
pCurrentPO = ppPrototypes[uiPOCurrentIndex];
++uiPOCurrentIndex;
CHECK_RET(getPOLocationOrigin(pCurrentPO, &sAnnotationFramePos));
sAnnotationFramePos.m_dX += sAnnotationFramePosOffset.m_dX;
sAnnotationFramePos.m_dY += sAnnotationFramePosOffset.m_dY;
sAnnotationFramePos.m_dZ += sAnnotationFramePosOffset.m_dZ;
CHECK_RET(createMarkupFaceToScreen(&pNewAnnotation,
pcTextAttached,
1,
&pRiPolyBrepModel,
&pCurrentPO,
&sAnnotationFramePos,
FlatToScreenAlwaysOnTop));
vpAnnotations.push_back(pNewAnnotation);
// ------------------------------------------------------------------
// Highlight all prototypes passed
A3DUTF8Char *pcTextHighlightAll = (A3DUTF8Char *)"Highlight All";
A3DVector3dData sHighlightAllPos;
A3D_INITIALIZE_DATA(A3DVector3dData, sHighlightAllPos);
sHighlightAllPos.m_dX = -4 * CUBE_WIDTH;
sHighlightAllPos.m_dY = -4 * CUBE_LENGTH;
sHighlightAllPos.m_dZ = -4 * CUBE_HEIGHT;
std::vector<A3DEntity*> vpLinkedEntity;
std::vector<A3DAsmProductOccurrence*> vpPOTarget;
for (A3DUns32 i = 0; i < uiPrototypesSize; ++i)
{
vpLinkedEntity.push_back(pRiPolyBrepModel);
vpPOTarget.push_back(ppPrototypes[i]);
}
CHECK_RET(createMarkupFaceToScreen(&pNewAnnotation,
pcTextHighlightAll,
uiPrototypesSize,
&vpLinkedEntity[0],
&vpPOTarget[0],
&sHighlightAllPos));
vpAnnotations.push_back(pNewAnnotation);
vpLinkedEntity.clear();
vpPOTarget.clear();
// ------------------------------------------------------------------
// Create a Markup Set and add markups in it
A3DMkpAnnotationSetData sAnnotationSetData;
A3D_INITIALIZE_DATA(A3DMkpAnnotationSetData, sAnnotationSetData);
sAnnotationSetData.m_uiAnnotationsSize = (A3DUns32)vpAnnotations.size();
sAnnotationSetData.m_ppAnnotations = &(vpAnnotations[0]);
CHECK_RET(A3DMkpAnnotationSetCreate(&sAnnotationSetData, ppOutAnnotationsSet));
vpAnnotations.clear();
return iRet;
}
//######################################################################################################################
A3DStatus createFileViews(A3DUns32* puiOutMkpViewSize, A3DMkpView*** pppOutMkpViews,
A3DUns32 uiPrototypesSize, A3DAsmProductOccurrence** ppPrototypes,
A3DUns32 uiAnnotationSize, A3DMkpAnnotationItem** ppMkpAnnotationItem,
A3DRiPolyBrepModel* pRiPolyBrepModel)
{
A3DStatus iRet = A3D_SUCCESS;
std::vector<A3DMkpView*> vpMkpViews;
*puiOutMkpViewSize = 0;
A3DVector3dData sCameraPos;
A3DVector3dData sCameraLookAt;
// ------------------------------------------------------------------
// "A View With A Camera"
A3D_INITIALIZE_DATA(A3DVector3dData, sCameraPos);
sCameraPos.m_dX = stCameraPosDefault.m_dX;
sCameraPos.m_dY = stCameraPosDefault.m_dY;
sCameraPos.m_dZ = stCameraPosDefault.m_dZ;
A3D_INITIALIZE_DATA(A3DVector3dData, sCameraLookAt);
sCameraLookAt.m_dX = stCameraLookAtDefault.m_dX;
sCameraLookAt.m_dY = stCameraLookAtDefault.m_dY;
sCameraLookAt.m_dZ = stCameraLookAtDefault.m_dZ;
A3DMkpView* pMkpViewWithCamera = 0;
A3DMkpViewData sMkpViewWithCamera;
A3D_INITIALIZE_DATA(A3DMkpViewData, sMkpViewWithCamera);
CHECK_RET(setViewCameraPlacement(&sMkpViewWithCamera, &sCameraPos, &sCameraLookAt, -1, -1));
CHECK_RET(createView(&pMkpViewWithCamera, &sMkpViewWithCamera, "Define New Camera"));
vpMkpViews.push_back(pMkpViewWithCamera);
// ------------------------------------------------------------------
// "A View That Hide Objects"
A3DAsmProductOccurrence* ppPOsToHide[3];
ppPOsToHide[0] = ppPrototypes[0];
ppPOsToHide[1] = ppPrototypes[2];
ppPOsToHide[2] = ppPrototypes[4];
A3DRootBaseWithGraphicsData sRootBaseWithGraphicsHiddenData;
A3D_INITIALIZE_DATA(A3DRootBaseWithGraphicsData, sRootBaseWithGraphicsHiddenData);
CHECK_RET(setGraphicsHidden(&sRootBaseWithGraphicsHiddenData));
A3DMkpViewData sMkpViewHidingObjects;
A3D_INITIALIZE_DATA(A3DMkpViewData, sMkpViewHidingObjects);
CHECK_RET(setViewEntitiesGraphics(&sMkpViewHidingObjects, 3, ppPOsToHide, &sRootBaseWithGraphicsHiddenData));
CHECK_RET(A3DGraphicsDelete(sRootBaseWithGraphicsHiddenData.m_pGraphics));
A3DMkpView* pMkpViewHidingObjects = 0;
CHECK_RET(createView(&pMkpViewHidingObjects, &sMkpViewHidingObjects, "Hide Objects"));
vpMkpViews.push_back(pMkpViewHidingObjects);
free(sMkpViewHidingObjects.m_ppLinkedItems);
// ------------------------------------------------------------------
// "A View That Change Objects Color"
A3DAsmProductOccurrence* ppPOsToChangeColor[2];
ppPOsToChangeColor[0] = ppPrototypes[1];
ppPOsToChangeColor[1] = ppPrototypes[3];
A3DRootBaseWithGraphicsData sRootBaseWithGraphicsYellowColorData;
A3D_INITIALIZE_DATA(A3DRootBaseWithGraphicsData, sRootBaseWithGraphicsYellowColorData);
CHECK_RET(setGraphicsColor(&sRootBaseWithGraphicsYellowColorData, YELLOW, 1.0));
A3DMkpViewData sMkpViewChangingObjectColor;
A3D_INITIALIZE_DATA(A3DMkpViewData, sMkpViewChangingObjectColor);
CHECK_RET(setViewEntitiesGraphics(&sMkpViewChangingObjectColor, 2, ppPOsToChangeColor, &sRootBaseWithGraphicsYellowColorData));
CHECK_RET(A3DGraphicsDelete(sRootBaseWithGraphicsYellowColorData.m_pGraphics));
A3DMkpView* pMkpViewChangingObjectColor = 0;
CHECK_RET(createView(&pMkpViewChangingObjectColor, &sMkpViewChangingObjectColor, "Change Objects Color"));
vpMkpViews.push_back(pMkpViewChangingObjectColor);
free(sMkpViewChangingObjectColor.m_ppLinkedItems);
// ------------------------------------------------------------------
// "A View That Change Face Color"
A3DMiscMarkupLinkedItem* pMarkupLinkedItem = NULL;
A3DUns32 faceindex[1];
faceindex[0] = 0;
CHECK_RET(createMarkupLinkedItemOnTess(pRiPolyBrepModel, kA3DTypeTessFace, 1, faceindex, ppPrototypes[2], &pMarkupLinkedItem));
A3DMiscMarkupLinkedItem* ppLinkedItemsToChangeColorOnFace[1];
ppLinkedItemsToChangeColorOnFace[0] = pMarkupLinkedItem;
A3DRootBaseWithGraphicsData sRootBaseWithGraphicsGreenColorData;
A3D_INITIALIZE_DATA(A3DRootBaseWithGraphicsData, sRootBaseWithGraphicsGreenColorData);
CHECK_RET(setGraphicsColor(&sRootBaseWithGraphicsGreenColorData, GREEN, 1.0));
CHECK_RET(A3DRootBaseWithGraphicsSet(ppLinkedItemsToChangeColorOnFace[0], &sRootBaseWithGraphicsGreenColorData));
CHECK_RET(A3DGraphicsDelete(sRootBaseWithGraphicsGreenColorData.m_pGraphics));
A3DMkpViewData sMkpViewChangingFaceColor;
A3D_INITIALIZE_DATA(A3DMkpViewData, sMkpViewChangingFaceColor);
CHECK_RET(addViewLinkedItem(&sMkpViewChangingFaceColor, 1, ppLinkedItemsToChangeColorOnFace));
A3DMkpView* pMkpViewChangingFaceColor = 0;
CHECK_RET(createView(&pMkpViewChangingFaceColor, &sMkpViewChangingFaceColor, "Change Face Color"));
vpMkpViews.push_back(pMkpViewChangingFaceColor);
free(sMkpViewChangingFaceColor.m_ppLinkedItems);
// ------------------------------------------------------------------
// "A View With Visible Annotation"
A3DMkpAnnotationItem* ppAnnotations[2];
ppAnnotations[0] = ppMkpAnnotationItem[1];
ppAnnotations[1] = ppMkpAnnotationItem[2];
A3DMkpViewData sMkpViewWithAnnotation;
A3D_INITIALIZE_DATA(A3DMkpViewData, sMkpViewWithAnnotation);
CHECK_RET(setViewAnnotations(&sMkpViewWithAnnotation, 2, ppAnnotations));
A3DMkpView* pMkpViewWithAnnotation = 0;
CHECK_RET(createView(&pMkpViewWithAnnotation, &sMkpViewWithAnnotation, "Visible Annotation"));
vpMkpViews.push_back(pMkpViewWithAnnotation);
// ------------------------------------------------------------------
// "A View With That Change Object Position"
A3DMiscCartesianTransformation* ppTransformations[3];
A3DMiscCartesianTransformationData sTransformationData;
A3D_INITIALIZE_DATA(A3DMiscCartesianTransformationData, sTransformationData);
sTransformationData.m_sOrigin.m_dX = CUBE_SPACING + CUBE_SPACING;
sTransformationData.m_sOrigin.m_dY = CUBE_SPACING;
sTransformationData.m_sOrigin.m_dZ = CUBE_SPACING;
sTransformationData.m_sXVector.m_dX = 1.;
sTransformationData.m_sXVector.m_dY = 0.;
sTransformationData.m_sXVector.m_dZ = 0.;
sTransformationData.m_sYVector.m_dX = 0.;
sTransformationData.m_sYVector.m_dY = 1.;
sTransformationData.m_sYVector.m_dZ = 0.;
sTransformationData.m_sScale.m_dX = 1.;
sTransformationData.m_sScale.m_dY = 1.;
sTransformationData.m_sScale.m_dZ = 1.;
CHECK_RET(A3DMiscCartesianTransformationCreate(&sTransformationData, &ppTransformations[0]));
CHECK_RET(A3DMiscCartesianTransformationCreate(&sTransformationData, &ppTransformations[1]));
CHECK_RET(A3DMiscCartesianTransformationCreate(&sTransformationData, &ppTransformations[2]));
A3DAsmProductOccurrence* ppPOsToChangePos[3];
ppPOsToChangePos[0] = ppPrototypes[0];
ppPOsToChangePos[1] = ppPrototypes[1];
ppPOsToChangePos[2] = ppPrototypes[2];
A3DMkpViewData sMkpViewChangeObjectPos;
A3D_INITIALIZE_DATA(A3DMkpViewData, sMkpViewChangeObjectPos);
CHECK_RET(setViewEntitiesOffsetPosition(&sMkpViewChangeObjectPos, 3, ppPOsToChangePos, ppTransformations));
A3DEntityDelete(ppTransformations[0]);
A3DEntityDelete(ppTransformations[1]);
A3DEntityDelete(ppTransformations[2]);
A3DMkpView* pMkpViewChangeObjectPos = 0;
CHECK_RET(createView(&pMkpViewChangeObjectPos, &sMkpViewChangeObjectPos, "Change Object Position"));
vpMkpViews.push_back(pMkpViewChangeObjectPos);
free(sMkpViewChangeObjectPos.m_ppLinkedItems);
// ------------------------------------------------------------------
// "Default View with Camera and all annotations"
A3D_INITIALIZE_DATA(A3DVector3dData, sCameraPos);
sCameraPos.m_dX = 0;
sCameraPos.m_dY = 0;
sCameraPos.m_dZ = uiPrototypesSize * (CUBE_LENGTH + CUBE_SPACING);
A3D_INITIALIZE_DATA(A3DVector3dData, sCameraLookAt);
sCameraLookAt.m_dX = uiPrototypesSize * (CUBE_WIDTH + CUBE_SPACING) / 2.;
sCameraLookAt.m_dY = uiPrototypesSize * (CUBE_HEIGHT + CUBE_SPACING) / 2.;
sCameraLookAt.m_dZ = uiPrototypesSize * CUBE_LENGTH;
A3DDouble dXFovy = (uiPrototypesSize +1) * (CUBE_WIDTH + CUBE_SPACING) / 2.;
A3DDouble dYFovy = (uiPrototypesSize +1) * (CUBE_HEIGHT + CUBE_SPACING) / 2.;
A3DMkpViewData sMkpViewDefault;
A3D_INITIALIZE_DATA(A3DMkpViewData, sMkpViewDefault);
CHECK_RET(setViewCameraPlacement(&sMkpViewDefault, &sCameraPos, &sCameraLookAt, dXFovy, dYFovy));
CHECK_RET(setViewAnnotations(&sMkpViewDefault, uiAnnotationSize, ppMkpAnnotationItem));
A3DMkpView* pMkpViewDefault = 0;
CHECK_RET(createView(&pMkpViewDefault, &sMkpViewDefault, "Default View"));
vpMkpViews.push_back(pMkpViewDefault);
// ------------------------------------------------------------------
// copy view vector
*puiOutMkpViewSize = (A3DUns32)vpMkpViews.size();
A3DMkpView** ppMkpViews = new A3DMkpView*[vpMkpViews.size()];
for (A3DUns32 i = 0; i < (A3DUns32)vpMkpViews.size(); ++i)
{
ppMkpViews[i] = vpMkpViews[i];
}
*pppOutMkpViews = ppMkpViews;
return iRet;
}
//######################################################################################################################
A3DStatus createPRCCubesFile(A3DAsmModelFile** ppModelFile, const A3DUTF8Char* pcTextureFilePath = NULL)
{
A3DStatus iRet = A3D_SUCCESS;
// ------------------------------------------------------------------
// create Texture if needed
A3DUns32 uiStyleIndex = A3D_DEFAULT_STYLE_INDEX; // will become the texture index
if (pcTextureFilePath != NULL)
{
// the picture width and height are read from the image (for supported image types),
// and since we don't know them, width and height can be 0
iRet = createTexture(pcTextureFilePath, kA3DPictureJpg, 0, 0, uiStyleIndex); // JPG
//iRet = createTexture(pcTextureFilePath, kA3DPicturePng, 0, 0, uiStyleIndex); // PNG
}
// ------------------------------------------------------------------
// create a cube tessellation
A3DTess3D* pTess3D = NULL;
CHECK_RET(createCubeTessellation(&pTess3D, &uiStyleIndex));
// ------------------------------------------------------------------
// create a PolyBrepModel representation item
A3DRiPolyBrepModel *pRiPolyBrepModel = NULL;
CHECK_RET(createPolyBREPModel(&pRiPolyBrepModel, pTess3D));
// ------------------------------------------------------------------
// create a PartDefinition to hold the PolyBrepModel and markups
A3DAsmPartDefinition *pPartDefinition = NULL;
CHECK_RET(createPart(&pPartDefinition, &pRiPolyBrepModel, 1));
// ------------------------------------------------------------------
// create a ProductOccurrence to stock the Part Definition
A3DAsmProductOccurrence* pPO = NULL;
A3DAsmProductOccurrenceData sPOData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sPOData);
sPOData.m_pPart = pPartDefinition;
CHECK_RET(A3DAsmProductOccurrenceCreate(&sPOData, &pPO));
// ------------------------------------------------------------------
// Create Prototypes
// Create N PO using previous PO as prototype
A3DUns32 uiPOSize = 6;
A3DAsmProductOccurrence** ppPOs = 0;
CHECK_RET(createAssemblyTree(pPO, uiPOSize, &ppPOs));
// ------------------------------------------------------------------
// create Markups
A3DMkpAnnotationItem* pMkpAnnotationSet = 0;
CHECK_RET(createFileMarkups(&pMkpAnnotationSet, uiPOSize, ppPOs, pRiPolyBrepModel));
// ------------------------------------------------------------------
// create Views
A3DUns32 uiMkpViewsSize = 0;
A3DMkpView** ppMkpViews = 0;
A3DMkpAnnotationSetData sAnnotationSetData;
A3D_INITIALIZE_DATA(A3DMkpAnnotationSetData, sAnnotationSetData);
CHECK_RET(A3DMkpAnnotationSetGet(pMkpAnnotationSet, &sAnnotationSetData));
CHECK_RET(createFileViews(&uiMkpViewsSize, &ppMkpViews,
uiPOSize, ppPOs,
sAnnotationSetData.m_uiAnnotationsSize, sAnnotationSetData.m_ppAnnotations,
pRiPolyBrepModel));
CHECK_RET(A3DMkpAnnotationSetGet(nullptr,&sAnnotationSetData));
// ------------------------------------------------------------------
// create the Root Product Occurrence.
A3DAsmProductOccurrence* pSubAsm = NULL;
A3DAsmProductOccurrenceData sSubAsmData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sSubAsmData);
sSubAsmData.m_uiPOccurrencesSize = uiPOSize;
sSubAsmData.m_ppPOccurrences = ppPOs;
if (pMkpAnnotationSet)
{
sSubAsmData.m_uiAnnotationsSize = 1;
sSubAsmData.m_ppAnnotations = &pMkpAnnotationSet;
}
sSubAsmData.m_uiViewsSize = uiMkpViewsSize;
sSubAsmData.m_ppViews = ppMkpViews;
CHECK_RET(A3DAsmProductOccurrenceCreate(&sSubAsmData, &pSubAsm));
// delete allocated datas
if (uiPOSize != 0) delete ppPOs;
if (uiMkpViewsSize != 0) delete ppMkpViews;
// ------------------------------------------------------------------
// Insertion of the whole product structure in the modelfile
A3DAsmModelFileData sData;
A3D_INITIALIZE_DATA(A3DAsmModelFileData, sData);
sData.m_uiPOccurrencesSize = 1;
sData.m_dUnit = 1.0;
sData.m_ppPOccurrences = &pSubAsm;
CHECK_RET(A3DAsmModelFileCreate(&sData, ppModelFile));
return iRet;
}

View File

@@ -0,0 +1,28 @@
#pragma once
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateTextures.cpp
* This file is containing the function allowing to create textures.
*
* Texture creation exemple
* Create the style corresponding to texture.
*
*
***********************************************************************************************************************/
#pragma once
#include "CreatePRCCubesDef.h"
//######################################################################################################################
// Create the style corresponding to texture.
A3DStatus createPRCCubesFile(A3DAsmModelFile** ppModelFile, const A3DUTF8Char* pcTextureFilePath);

View File

@@ -0,0 +1,126 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreatePRCCubes.cpp
* This file is containing the main trunc of the CreatePRCCubes sample.
*
* The purpose of this sample is to propose an embryo set of functionality allowing the creation of various PRC entities.
* It proposes and tackles different modules such as:
* - creation of markups: see CreateMarkups.cpp
* - creation of views: see CreateViews.cpp
* - creation of textures: see CreateTextures.cpp
* - creation of colors: see CreateGraphics.cpp
* - creation of links between entities: see CreateLinkedItem.cpp
*
* Inside this files is created either a PRC or a PDF file with a defined structures,
* a certain number of markups and a certain number of views.
*
* The function createAssemblyTree, createFileMarkups, createFileViews
* can be modified to create your own PRC or PDF file:
* modifying the structure can be done in createAssemblyTree.
* modifying the views can be done in createFileViews.
* modifying the markups can be done in createFileMarkups.
*
* It should be the reference sample for PRC entity creation but is also a great tool to understand how the PRC tree is working.
*
***********************************************************************************************************************/
#define INITIALIZE_A3D_API
#include "CreatePRCCubesDef.h"
#include "CreateModelFile.h"
#include <vector>
static MY_CHAR acDstFileName[_MAX_PATH * 2];
static MY_CHAR acJpgFileName[_MAX_PATH * 2];
static MY_CHAR acLogFileName[_MAX_PATH * 2];
//######################################################################################################################
/*
void debugCheckRet()
{
printf("debug");
}
#define CHECK_RET(function_call) {\
iRet = function_call; if(iRet != A3D_SUCCESS) { debugCheckRet(); std::cout << "Error number=" << iRet << std::endl; return iRet; }\
}
*/
//######################################################################################################################
// Main function
#ifdef _MSC_VER
int wmain(A3DInt32 iArgc, A3DUniChar** ppcArgv)
#else
int main(A3DInt32 iArgc, A3DUTF8Char** ppcArgv)
#endif
{
//
// ### COMMAND LINE ARGUMENTS
//
if (iArgc > 4 || iArgc < 2)
{
MY_PRINTF2("Usage:\n %s [output PRC file] [existing JPG file] [output LOG file]\n", ppcArgv[0]);
MY_PRINTF(" Default existing JPG file is [output PRC file].jpg\n");
MY_PRINTF(" Default output LOG file is [output PRC file]_Log.txt\n\n");
return A3D_ERROR;
}
MY_STRCPY(acDstFileName, ppcArgv[1]);
if (iArgc > 2) MY_STRCPY(acJpgFileName, ppcArgv[2]);
else MY_SPRINTF(acJpgFileName, "%s.jpg", acDstFileName);
if (iArgc > 3) MY_STRCPY(acLogFileName, ppcArgv[3]);
else MY_SPRINTF(acLogFileName, "%s_Log.txt", acDstFileName);
GetLogFile(acLogFileName); // Initialize log file
//
// ### INITIALIZE HOOPS EXCHANGE
//
A3DSDKHOOPSExchangeLoader sHoopsExchangeLoader(_T(HOOPS_BINARY_DIRECTORY));
CHECK_RET(sHoopsExchangeLoader.m_eSDKStatus);
// Initialize callbacks
CHECK_RET(A3DDllSetCallbacksMemory(CheckMalloc, CheckFree));
CHECK_RET(A3DDllSetCallbacksReport(PrintLogMessage, PrintLogWarning, PrintLogError));
//
// ### PROCESS SAMPLE CODE
//
A3DUTF8Char sJPGFileNameUTF8[_MAX_PATH];
#ifdef _MSC_VER
A3DMiscUTF16ToUTF8(acJpgFileName, sJPGFileNameUTF8);
#else
MY_STRCPY(sJPGFileNameUTF8, acJpgFileName);
#endif
CHECK_RET(createPRCCubesFile(&sHoopsExchangeLoader.m_psModelFile, sJPGFileNameUTF8));
if (sHoopsExchangeLoader.m_psModelFile)
{
A3DExport sExport(acDstFileName); // see A3DSDKInternalConvert.hxx for import and export detailed parameters
CHECK_RET(sHoopsExchangeLoader.Export(sExport));
}
//
// ### TERMINATE HOOPS EXCHANGE
//
// Check memory allocations
return (int)ListLeaks();
}

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BC7D4477-04C9-426D-93A1-3401DFD12A0F}</ProjectGuid>
<RootNamespace>CreatePRCCubes</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v145</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v145</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v145</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v145</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)\HOOPSExchangePublishSample.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)\HOOPSExchangePublishSample.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)\HOOPSExchangePublishSample.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)\HOOPSExchangePublishSample.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SDLCheck>false</SDLCheck>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
<Link>
<ShowProgress>LinkVerboseLib</ShowProgress>
<AdditionalLibraryDirectories>..\..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SDLCheck>false</SDLCheck>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
<Link>
<ShowProgress>LinkVerboseLib</ShowProgress>
<AdditionalLibraryDirectories>..\..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SDLCheck>false</SDLCheck>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
<Link>
<AdditionalLibraryDirectories>..\..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SDLCheck>false</SDLCheck>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
<Link>
<AdditionalLibraryDirectories>..\..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="CreateModelFile.cpp" />
<ClCompile Include="CreatePRCCubes.cpp" />
<ClCompile Include="CreatePRCCubesDef.cpp" />
<ClCompile Include="CreateTessellatedCubes.cpp" />
<ClCompile Include="modules\CreateGraphics.cpp" />
<ClCompile Include="modules\CreateLinkedItem.cpp" />
<ClCompile Include="modules\CreateMarkups.cpp" />
<ClCompile Include="modules\CreateTextures.cpp" />
<ClCompile Include="modules\CreateViews.cpp" />
<ClCompile Include="tessellation_wrapper\HXWBasicTessellation.cpp" />
<ClCompile Include="tessellation_wrapper\HXWEntity.cpp" />
<ClCompile Include="tessellation_wrapper\HXWMarkupTessellation.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="CreateModelFile.h" />
<ClInclude Include="CreatePRCCubesDef.h" />
<ClInclude Include="CreateTessellatedCubes.h" />
<ClInclude Include="modules\CreateGraphics.h" />
<ClInclude Include="modules\CreateLinkedItem.h" />
<ClInclude Include="modules\CreateMarkups.h" />
<ClInclude Include="modules\CreateTextures.h" />
<ClInclude Include="modules\CreateViews.h" />
<ClInclude Include="tessellation_wrapper\HXWBasicTessellation.h" />
<ClInclude Include="tessellation_wrapper\HXWEntity.h" />
<ClInclude Include="tessellation_wrapper\HXWMarkupTessellation.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Header Files\modules">
<UniqueIdentifier>{23b8ef04-6569-4cf4-af31-43582f5c740c}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\modules">
<UniqueIdentifier>{7bcb00e4-9093-4036-aa36-52d8159d90b6}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\tessellation_wrapper">
<UniqueIdentifier>{0cd497a1-32aa-47ca-9344-e9b84346f5c2}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\tessellation_wrapper">
<UniqueIdentifier>{99e4792e-f4f5-43a5-8da0-c4b7fad52fd5}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CreatePRCCubes.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CreateModelFile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CreatePRCCubesDef.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CreateTessellatedCubes.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tessellation_wrapper\HXWEntity.cpp">
<Filter>Source Files\tessellation_wrapper</Filter>
</ClCompile>
<ClCompile Include="tessellation_wrapper\HXWMarkupTessellation.cpp">
<Filter>Source Files\tessellation_wrapper</Filter>
</ClCompile>
<ClCompile Include="tessellation_wrapper\HXWBasicTessellation.cpp">
<Filter>Source Files\tessellation_wrapper</Filter>
</ClCompile>
<ClCompile Include="modules\CreateGraphics.cpp">
<Filter>Source Files\modules</Filter>
</ClCompile>
<ClCompile Include="modules\CreateLinkedItem.cpp">
<Filter>Source Files\modules</Filter>
</ClCompile>
<ClCompile Include="modules\CreateMarkups.cpp">
<Filter>Source Files\modules</Filter>
</ClCompile>
<ClCompile Include="modules\CreateTextures.cpp">
<Filter>Source Files\modules</Filter>
</ClCompile>
<ClCompile Include="modules\CreateViews.cpp">
<Filter>Source Files\modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CreateTessellatedCubes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CreatePRCCubesDef.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CreateModelFile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="tessellation_wrapper\HXWEntity.h">
<Filter>Header Files\tessellation_wrapper</Filter>
</ClInclude>
<ClInclude Include="tessellation_wrapper\HXWMarkupTessellation.h">
<Filter>Header Files\tessellation_wrapper</Filter>
</ClInclude>
<ClInclude Include="tessellation_wrapper\HXWBasicTessellation.h">
<Filter>Header Files\tessellation_wrapper</Filter>
</ClInclude>
<ClInclude Include="modules\CreateGraphics.h">
<Filter>Header Files\modules</Filter>
</ClInclude>
<ClInclude Include="modules\CreateLinkedItem.h">
<Filter>Header Files\modules</Filter>
</ClInclude>
<ClInclude Include="modules\CreateMarkups.h">
<Filter>Header Files\modules</Filter>
</ClInclude>
<ClInclude Include="modules\CreateTextures.h">
<Filter>Header Files\modules</Filter>
</ClInclude>
<ClInclude Include="modules\CreateViews.h">
<Filter>Header Files\modules</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,75 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreatePRCCubesDef.h
*
* Includes and defines variable used in the rest of the project.
*
***********************************************************************************************************************/
#include "CreatePRCCubesDef.h"
//######################################################################################################################
A3DStatus setEntityName(A3DEntity* pEntity, const A3DUTF8Char* pName)
{
A3DStatus iRet = A3D_SUCCESS;
if (pEntity != NULL)
{
A3DRootBaseData sBaseData;
A3D_INITIALIZE_DATA(A3DRootBaseData, sBaseData);
CHECK_RET(A3DRootBaseGet(pEntity, &sBaseData));
A3DUTF8Char* pTmpStr = sBaseData.m_pcName;
sBaseData.m_pcName = (A3DUTF8Char*) pName;
CHECK_RET(A3DRootBaseSet(pEntity, &sBaseData));
sBaseData.m_pcName = pTmpStr;
CHECK_RET(A3DRootBaseGet(nullptr, &sBaseData));
}
return iRet;
}
//######################################################################################################################
A3DStatus addEntityAttributes(A3DEntity* pEntity, A3DUns32 uiAttributeSize, A3DMiscAttribute** ppAttributes)
{
A3DStatus iRet = A3D_SUCCESS;
if (pEntity != NULL)
{
CHECK_RET(A3DRootBaseAttributeAppend(pEntity, uiAttributeSize, ppAttributes));
}
return iRet;
}
//######################################################################################################################
A3DStatus getPOLocationOrigin(A3DAsmProductOccurrence* pPO, A3DVector3dData* pOutPos)
{
A3DStatus iRet = A3D_SUCCESS;
if (pOutPos == 0) return A3D_ERROR;
A3DAsmProductOccurrenceData sPOData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sPOData);
CHECK_RET(A3DAsmProductOccurrenceGet(pPO, &sPOData));
if (sPOData.m_pLocation)
{
A3DMiscCartesianTransformationData sTransforamationData;
A3D_INITIALIZE_DATA(A3DMiscCartesianTransformationData, sTransforamationData);
CHECK_RET(A3DMiscCartesianTransformationGet(sPOData.m_pLocation, &sTransforamationData));
pOutPos->m_dX = sTransforamationData.m_sOrigin.m_dX;
pOutPos->m_dY = sTransforamationData.m_sOrigin.m_dY;
pOutPos->m_dZ = sTransforamationData.m_sOrigin.m_dZ;
}
return iRet;
}

View File

@@ -0,0 +1,43 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreatePRCCubesDef.h
*
* Includes, macros and tools used in the rest of the project.
*
*
***********************************************************************************************************************/
#pragma once
#include <A3DSDKIncludes.h>
#include <iostream>
#include "../common.hpp"
//######################################################################################################################
#define INFINITE_COORD 12345.0
#define PI 3.14159265358979323846
#define CUBE_WIDTH 50
#define CUBE_HEIGHT 50
#define CUBE_LENGTH 50
#define CUBE_SPACING 300
//######################################################################################################################
A3DStatus setEntityName(A3DEntity* pEntity, const A3DUTF8Char* pName);
A3DStatus addEntityAttributes(A3DEntity* pEntity, A3DUns32 uiAttributeSize, A3DMiscAttribute** ppAttributes);
A3DStatus getPOLocationOrigin(A3DAsmProductOccurrence* pPO, A3DVector3dData* pOutPos);

View File

@@ -0,0 +1,188 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateTessellatedCubes.cpp
* This file is containing the data and function used to create PRC Tessellation.
*
* fillCubeTessBaseData is filling the structure A3DTessBaseData
* A3DTessBaseData is the structure containing the coordinates of the tessellation.
*
* fillCubeTessData is filling the structure A3DTess3DData
* A3DTess3DData is the structure describing the coordinates from A3DTessBaseData
* It contains indexes of vertex coordinates, wire frames coordinates, normals and textures coordinates.
*
*
***********************************************************************************************************************/
#include "CreateTessellatedCubes.h"
//######################################################################################################################
// Cube Tessellation structures completion
// filling A3DTessBaseData: containing the coordinates of the tessellation.
void fillCubeTessBaseData(A3DTessBaseData& sTessBaseData, A3DDouble cubeWidth, A3DDouble cubeHeight, A3DDouble cubeLength)
{
A3D_INITIALIZE_DATA(A3DTessBaseData, sTessBaseData);
sTessBaseData.m_bIsCalculated = false;
// Point coordinates
sTessBaseData.m_uiCoordSize = 24;
sTessBaseData.m_pdCoords = (A3DDouble*) malloc((size_t) sTessBaseData.m_uiCoordSize * sizeof(A3DDouble));
A3DUns32 ui;
for (ui = 0; ui < sTessBaseData.m_uiCoordSize / 3; ++ui)
{
sTessBaseData.m_pdCoords[3 * ui] = stCubePoints[3 * ui] * cubeWidth;
sTessBaseData.m_pdCoords[3 * ui + 1] = stCubePoints[3 * ui + 1] * cubeHeight;
sTessBaseData.m_pdCoords[3 * ui + 2] = stCubePoints[3 * ui + 2] * cubeLength;
}
}
void freeTessBaseData(A3DTessBaseData& sTessBaseData)
{
free(sTessBaseData.m_pdCoords);
}
//######################################################################################################################
// Cube Tessellation structures completion
// filling A3DTess3DData:describing the coordinates from A3DTessBaseData
// indexes of vertex coordinates, wire frames coordinates, normals and textures coordinates.
void fillCubeTessData(A3DTess3DData& sTess3DData, A3DUns32* puiStyleIndex)
{
A3D_INITIALIZE_DATA(A3DTess3DData, sTess3DData);
A3DUns32 ui;
// Normal coordinates
sTess3DData.m_uiNormalSize = 18;
sTess3DData.m_pdNormals = (A3DDouble*) malloc((size_t) sTess3DData.m_uiNormalSize * sizeof(A3DDouble));
for (ui = 0; ui < sTess3DData.m_uiNormalSize; ++ui)
sTess3DData.m_pdNormals[ui] = stCubeNormals[ui];
if (puiStyleIndex != NULL)
{
// UV coordinates
sTess3DData.m_uiTextureCoordSize = 8;
sTess3DData.m_pdTextureCoords =
(A3DDouble*) malloc(sTess3DData.m_uiTextureCoordSize * A3DUns32(sizeof(A3DDouble)));
for (ui = 0; ui < sTess3DData.m_uiTextureCoordSize; ++ui)
{
sTess3DData.m_pdTextureCoords[ui] = stCubeUV[ui];
}
}
// Faces
sTess3DData.m_bHasFaces = true; // Geometrical face notion?
sTess3DData.m_uiFaceTessSize = 6;
sTess3DData.m_psFaceTessData =
(A3DTessFaceData*) malloc((size_t) sTess3DData.m_uiFaceTessSize * sizeof(A3DTessFaceData));
for (ui = 0; ui < sTess3DData.m_uiFaceTessSize; ++ui)
A3D_INITIALIZE_DATA(A3DTessFaceData, (sTess3DData.m_psFaceTessData[ui]));
// All the point, normal and texture indexes are stored in the A3DTess3D.
// The faces describes how to interpret these indices.
if (puiStyleIndex != NULL)
{
sTess3DData.m_uiTriangulatedIndexSize = 18 * 6;
sTess3DData.m_puiTriangulatedIndexes = (A3DUns32*) malloc(sTess3DData.m_uiTriangulatedIndexSize * A3DUns32(sizeof(A3DUns32)));
for (ui = 0; ui < sTess3DData.m_uiTriangulatedIndexSize; ++ui)
{
sTess3DData.m_puiTriangulatedIndexes[ui] = stTexturedCubeFacesNormalPTrianglesUV[ui];
}
}
else
{
sTess3DData.m_uiTriangulatedIndexSize = 12 * 6;
sTess3DData.m_puiTriangulatedIndexes = (A3DUns32*) malloc((size_t) sTess3DData.m_uiTriangulatedIndexSize * sizeof(A3DUns32));
for (ui = 0; ui < sTess3DData.m_uiTriangulatedIndexSize; ++ui)
{
sTess3DData.m_puiTriangulatedIndexes[ui] = stCubeFacesNormalPTrianglesUV[ui];
}
}
// Like above the edge point indices of the faces are stored in the A3DTess3D
sTess3DData.m_uiWireIndexSize = 8 * 6;
sTess3DData.m_puiWireIndexes = (A3DUns32*) malloc((size_t) sTess3DData.m_uiWireIndexSize * sizeof(A3DUns32));
for (ui = 0; ui < sTess3DData.m_uiWireIndexSize; ++ui)
sTess3DData.m_puiWireIndexes[ui] = stCubeFacesWireframe[ui];
A3DUns32 uj;
for (ui = 0; ui < sTess3DData.m_uiFaceTessSize; ++ui)
{
A3DTessFaceData& sFace = sTess3DData.m_psFaceTessData[ui];
// Type(s) of the entities of the face. This face contains only triangles with texture (with uv for each vertex).
if (puiStyleIndex != NULL)
{
sFace.m_usUsedEntitiesFlags = kA3DTessFaceDataTriangleTextured;
// indicates the texture of this face
if (*puiStyleIndex != A3D_DEFAULT_STYLE_INDEX)
{
sFace.m_uiStyleIndexesSize = 1;
sFace.m_puiStyleIndexes = (A3DUns32*) malloc(sFace.m_uiStyleIndexesSize * A3DUns32(sizeof(A3DUns32)));
sFace.m_puiStyleIndexes[0] = *puiStyleIndex;
}
// number of uv indices for each vertex of the face
// (a multi-textured face or a multi-referenced part should involve more than one uv index)
sFace.m_uiTextureCoordIndexesSize = 1;
// the description of the triangles of the face begins at this position
// in the m_puiTriangulatedIndexes array filled above.
sFace.m_uiStartTriangulated = ui * 18;
}
else
{
sFace.m_usUsedEntitiesFlags = kA3DTessFaceDataTriangle;
sFace.m_uiTextureCoordIndexesSize = 0;
sFace.m_uiStartTriangulated = ui * 12;
}
sFace.m_uiSizesTriangulatedSize = 1; // size of the next array
sFace.m_puiSizesTriangulated = (A3DUns32*) malloc(sFace.m_uiSizesTriangulatedSize * A3DUns32(sizeof(A3DUns32)));
sFace.m_puiSizesTriangulated[0] = 2; // number of triangles for this face
// wireframe of the face
sFace.m_uiSizesWiresSize = 4; // size of the next array corresponds to the number of edges
sFace.m_puiSizesWires = (A3DUns32*) malloc((size_t) sFace.m_uiSizesWiresSize * sizeof(A3DUns32));
for (uj = 0; uj < sFace.m_uiSizesWiresSize; ++uj)
sFace.m_puiSizesWires[uj] = 2; // two points for each edge
// to indicate that the loop is closed,
// the number of vertices of the last edge has the flag kA3DTessFaceDataWireIsClosing
sFace.m_puiSizesWires[sFace.m_uiSizesWiresSize - 1] |= kA3DTessFaceDataWireIsClosing;
// the description of the wireframe of the face begins at this position
// in the m_puiWireIndexes array filled above.
sFace.m_uiStartWire = ui * 8;
}
}
void freeTess3DData(A3DTess3DData& sTess3DData)
{
free(sTess3DData.m_pdNormals);
free(sTess3DData.m_pdTextureCoords);
free(sTess3DData.m_puiTriangulatedIndexes);
free(sTess3DData.m_puiWireIndexes);
A3DUns32 ui = sTess3DData.m_uiFaceTessSize;
for (ui = 0; ui < sTess3DData.m_uiFaceTessSize; ++ui)
{
if (sTess3DData.m_psFaceTessData[ui].m_puiStyleIndexes != NULL) // Texture is optionnal
free(sTess3DData.m_psFaceTessData[ui].m_puiStyleIndexes);
free(sTess3DData.m_psFaceTessData[ui].m_puiSizesTriangulated);
free(sTess3DData.m_psFaceTessData[ui].m_puiSizesWires);
}
free(sTess3DData.m_psFaceTessData);
}

View File

@@ -0,0 +1,113 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateTessellatedCubes.cpp
* This file is containing the data and function used to create PRC Tessellation.
*
* fillCubeTessBaseData is filling the structure A3DTessBaseData
* A3DTessBaseData is the structure containing the coordinates of the tessellation.
*
* fillCubeTessData is filling the structure A3DTess3DData
* A3DTess3DData is the structure describing the coordinates from A3DTessBaseData
* It contains indexes of vertex coordinates, wire frames coordinates, normals and textures coordinates.
*
*
***********************************************************************************************************************/
#pragma once
#include "CreatePRCCubesDef.h"
//######################################################################################################################
//Cube tessellation data
static A3DDouble stCubePoints[24] = {
-1, -1, 1,
1, -1, 1,
-1, 1, 1,
1, 1, 1,
-1, 1, -1,
1, 1, -1,
-1, -1, -1,
1, -1, -1
};
static A3DDouble stCubeNormals[18] = {
1., 0., 0.,
-1., 0., 0.,
0., 1., 0.,
0., -1., 0.,
0., 0., 1.,
0., 0., -1.
};
static A3DDouble stCubeUV[8] = {
0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0
// U V
};
#define ADD_FACE_COLOR
static A3DUns32 stCubeFacesNormalPTrianglesUV[72] =
{
//72 buffer count
// N, P, N, P, N, P, N, P, N, P, N, P
12, 0, 12, 3, 12, 6, 12, 6, 12, 3, 12, 9, // Face 0
6, 6, 6, 9, 6, 12, 6, 12, 6, 9, 6, 15, // Face 1
15, 12, 15, 15, 15, 18, 15, 18, 15, 15, 15, 21, // ....
9, 18, 9, 21, 9, 0, 9, 0, 9, 21, 9, 3,
0, 3, 0, 21, 0, 9, 0, 9, 0, 21, 0, 15,
3, 18, 3, 0, 3, 12, 3, 12, 3, 0, 3, 6, // Face N
};
// N = normal index
// U = UV index
// P = point coordinates index
static A3DUns32 stTexturedCubeFacesNormalPTrianglesUV[108] = {
12, 0, 0, 12, 2, 3, 12, 4, 6, 12, 4, 6, 12, 2, 3, 12, 6, 9, //Face0
6, 0, 6, 6, 2, 9, 6, 4, 12, 6, 4, 12, 6, 2, 9, 6, 6, 15, //Face1
15, 6, 12, 15, 4, 15, 15, 2, 18, 15, 2, 18, 15, 4, 15, 15, 0, 21, //....
9, 0, 18, 9, 2, 21, 9, 4, 0, 9, 4, 0, 9, 2, 21, 9, 6, 3,
0, 0, 3, 0, 2, 21, 0, 4, 9, 0, 4, 9, 0, 2, 21, 0, 6, 15,
3, 0, 18, 3, 2, 0, 3, 4, 12, 3, 4, 12, 3, 2, 0, 3, 6, 6 //FaceN
/*
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P Face 0
\ first triangle / \ second triangle /
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P Face 1
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P Face 2
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P ...
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P Face N
*/
};
static A3DUns32 stCubeFacesWireframe[48] = {
0, 3, 3, 9, 9, 6, 6, 0,/* Face 0 */
6, 9, 9, 15, 15, 12, 12, 6,/* Face 1 */
12, 15, 15, 21, 21, 18, 18, 12,/* .... */
18, 21, 21, 3, 3, 0, 0, 18,
3, 21, 21, 15, 15, 9, 9, 3,
18, 0, 0, 6, 6, 12, 12, 18 /* Face N */
/* E1 E2 E3 E4 edges */
};
//######################################################################################################################
void fillCubeTessBaseData(A3DTessBaseData& sTessBaseData, A3DDouble cubeWidth, A3DDouble cubeHeight, A3DDouble cubeLength);
void freeTessBaseData(A3DTessBaseData& sTessBaseData);
//######################################################################################################################
void fillCubeTessData(A3DTess3DData& sTess3DData, A3DUns32* puiStyleIndex = NULL);
void freeTess3DData(A3DTess3DData& sTess3DData);

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,144 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateGraphics.cpp
* This file is containing the function allowing to create graphics.
*
*
***********************************************************************************************************************/
#include "CreateGraphics.h"
//######################################################################################################################
// Color creation
A3DStatus createRGBColor(A3DUns32& uiIndexRgbColor, A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue)
{
A3DStatus iRet = A3D_SUCCESS;
A3DGraphRgbColorData sData;
A3D_INITIALIZE_DATA(A3DGraphRgbColorData, sData);
sData.m_dRed = dRed;
sData.m_dGreen = dGreen;
sData.m_dBlue = dBlue;
iRet = A3DGlobalInsertGraphRgbColor(&sData, &uiIndexRgbColor);
return iRet;
}
//######################################################################################################################
// Material creation: Creates a material, then inserts it into the global material table.
A3DStatus createMaterial(A3DUns32& uiMaterialGenericIndex, A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue)
{
A3DStatus iRet = A3D_SUCCESS;
A3DUns32 uiAmbient, uiDiffuse, uiEmissive, uiSpecular;
CHECK_RET(createRGBColor(uiAmbient, dRed, dGreen, dBlue));
CHECK_RET(createRGBColor(uiDiffuse, dRed, dGreen, dBlue));
CHECK_RET(createRGBColor(uiEmissive, dRed, dGreen, dBlue));
CHECK_RET(createRGBColor(uiSpecular, dRed, dGreen, dBlue));
A3DGraphMaterialData sMaterialData;
A3D_INITIALIZE_DATA(A3DGraphMaterialData, sMaterialData);
sMaterialData.m_uiAmbient = uiAmbient;
sMaterialData.m_uiDiffuse = uiDiffuse;
sMaterialData.m_uiEmissive = uiEmissive;
sMaterialData.m_uiSpecular = uiSpecular;
sMaterialData.m_dAmbientAlpha = 1.0;
sMaterialData.m_dDiffuseAlpha = 1.0;
sMaterialData.m_dEmissiveAlpha = 1.0;
sMaterialData.m_dSpecularAlpha = 1.0;
sMaterialData.m_dShininess = 0.0;
CHECK_RET(A3DGlobalInsertGraphMaterial(&sMaterialData, &uiMaterialGenericIndex));
return iRet;
}
//######################################################################################################################
A3DStatus setGraphicsColor(A3DRootBaseWithGraphicsData* pOutRootBaseWithGraphics, A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue, A3DDouble dAlpha)
{
A3DStatus iRet = A3D_SUCCESS;
//Create a style color
A3DUns32 uiColorIndex = 0;
CHECK_RET(createRGBColor(uiColorIndex, dRed, dGreen, dBlue));
A3DUns32 uiStyleIndex = 0;
A3DGraphStyleData sStyleData;
A3D_INITIALIZE_DATA(A3DGraphStyleData, sStyleData);
sStyleData.m_bMaterial = false;
sStyleData.m_bVPicture = false;
sStyleData.m_dWidth = 0.1; // default
sStyleData.m_bIsTransparencyDefined = true;
sStyleData.m_ucTransparency = (A3DUns8) (dAlpha * 255.0);
sStyleData.m_bSpecialCulling = false;
sStyleData.m_bBackCulling = false;
sStyleData.m_uiRgbColorIndex = uiColorIndex;
CHECK_RET(A3DGlobalInsertGraphStyle(&sStyleData, &uiStyleIndex));
A3DGraphicsData sGraphicsData;
A3D_INITIALIZE_DATA(A3DGraphicsData, sGraphicsData);
sGraphicsData.m_uiStyleIndex = uiStyleIndex;
sGraphicsData.m_usBehaviour = kA3DGraphicsShow;
sGraphicsData.m_usBehaviour |= kA3DGraphicsSonHeritColor;
CHECK_RET(A3DGraphicsCreate(&sGraphicsData, &(pOutRootBaseWithGraphics->m_pGraphics)));
return iRet;
}
A3DStatus setEntityColor(A3DEntity* inEntity, A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue, A3DDouble dAlpha)
{
A3DStatus iRet = A3D_SUCCESS;
A3DRootBaseWithGraphicsData sBaseWithGraphicsData;
A3D_INITIALIZE_DATA(A3DRootBaseWithGraphicsData, sBaseWithGraphicsData);
CHECK_RET(A3DRootBaseWithGraphicsGet(inEntity, &sBaseWithGraphicsData));
CHECK_RET(setGraphicsColor(&sBaseWithGraphicsData, dRed, dGreen, dBlue, dAlpha));
CHECK_RET(A3DRootBaseWithGraphicsSet(inEntity, &sBaseWithGraphicsData));
CHECK_RET(A3DGraphicsDelete(sBaseWithGraphicsData.m_pGraphics));
return iRet;
}
//######################################################################################################################
A3DStatus setGraphicsHidden(A3DRootBaseWithGraphicsData* pOutRootBaseWithGraphics)
{
A3DStatus iRet = A3D_SUCCESS;
A3DGraphicsData sGraphicsData;
A3D_INITIALIZE_DATA(A3DGraphicsData, sGraphicsData);
CHECK_RET(A3DGraphicsGet(pOutRootBaseWithGraphics->m_pGraphics, &sGraphicsData));
sGraphicsData.m_usBehaviour &= ~kA3DGraphicsShow;
sGraphicsData.m_usBehaviour |= kA3DGraphicsSonHeritShow;
CHECK_RET(A3DGraphicsCreate(&sGraphicsData, &(pOutRootBaseWithGraphics->m_pGraphics)));
return iRet;
}
A3DStatus setEntityHidden(A3DEntity* inEntity)
{
A3DStatus iRet = A3D_SUCCESS;
A3DRootBaseWithGraphicsData sBaseWithGraphicsData;
A3D_INITIALIZE_DATA(A3DRootBaseWithGraphicsData, sBaseWithGraphicsData);
CHECK_RET(A3DRootBaseWithGraphicsGet(inEntity, &sBaseWithGraphicsData));
CHECK_RET(setGraphicsHidden(&sBaseWithGraphicsData));
CHECK_RET(A3DRootBaseWithGraphicsSet(inEntity, &sBaseWithGraphicsData));
return iRet;
}

View File

@@ -0,0 +1,45 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateGraphics.cpp
* This file is containing the function allowing to create graphics.
*
*
***********************************************************************************************************************/
#pragma once
#include "../CreatePRCCubesDef.h"
//######################################################################################################################
#define WHITE 1.,1.,1.
#define DARK_GREY 0.2,0.2,0.2
#define RED 1.,0.,0.
#define GREEN 0.,1.,0.
#define BLUE 0.,0.,1.
#define YELLOW 1.,1.,0.
#define PURPLE 1.,0.,1.
#define TURQUOISE 0.,1.,1.
//######################################################################################################################
A3DStatus createRGBColor(A3DUns32& uiIndexRgbColor, A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue);
A3DStatus createMaterial(A3DUns32& uiMaterialGenericIndex, A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue);
A3DStatus setGraphicsColor(A3DRootBaseWithGraphicsData* pOutRootBaseWithGraphics, A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue, A3DDouble dAlpha);
A3DStatus setEntityColor(A3DEntity* inEntity, A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue, A3DDouble dAlpha);
A3DStatus setGraphicsHidden(A3DRootBaseWithGraphicsData* pOutRootBaseWithGraphics);
A3DStatus setEntityHidden(A3DEntity* inEntity);

View File

@@ -0,0 +1,117 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateLinkedItem.cpp
* This file is containing the function allowing to create linked items.
*
*
***********************************************************************************************************************/
#include "CreateMarkups.h"
//######################################################################################################################
//
// Linked Items
//
//######################################################################################################################
// Create a a link mparkup / entity
static A3DStatus stCreateLinkedItem(A3DEntity* pEntity, A3DAsmProductOccurrence *pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI)
{
A3DStatus iRet = A3D_SUCCESS;
A3DMiscMarkupLinkedItemData sMLIData;
A3D_INITIALIZE_DATA(A3DMiscMarkupLinkedItemData, sMLIData);
sMLIData.m_pTargetProductOccurrence = pPOTarget;
sMLIData.m_pReference = pEntity;
CHECK_RET(A3DMiscMarkupLinkedItemCreate(&sMLIData, ppMLI));
return iRet;
}
//######################################################################################################################
A3DStatus createMarkupLinkedItemOnProduct(A3DAsmProductOccurrence* pPO, A3DAsmProductOccurrence *pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI)
{
A3DStatus iRet = A3D_SUCCESS;
// pPo: setting a non-null reference
// m_pTargetProductOccurrence: setting the target ProductOccurrence to NULL if the reference is at the same level as the PO,
// or to the level above if the PO tree has several levels
iRet = (stCreateLinkedItem(pPO, pPOTarget, ppMLI));
return iRet;
}
A3DStatus createMarkupLinkedItemOnEntity(A3DEntity* pEntity,
A3DAsmProductOccurrence * pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI)
{
A3DStatus iRet = A3D_SUCCESS;
CHECK_RET(stCreateLinkedItem(pEntity, pPOTarget, ppMLI));
return iRet;
}
A3DStatus createMarkupLinkedItemOnTopo(A3DEntity* pEntity, A3DEEntityType eTopoItemType,
A3DUns32 uiAdditionalIndexesSize,
A3DUns32* puiAdditionalIndexes,
A3DAsmProductOccurrence* pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI)
{
A3DStatus iRet = A3D_SUCCESS;
A3DMiscReferenceOnTopologyData sReferenceOnTopologyData;
A3D_INITIALIZE_DATA(A3DMiscReferenceOnTopologyData, sReferenceOnTopologyData);
sReferenceOnTopologyData.m_eTopoItemType = eTopoItemType; // kA3DTypeTopoFace;
sReferenceOnTopologyData.m_pBrepData = pEntity;
sReferenceOnTopologyData.m_uiSize = uiAdditionalIndexesSize;
sReferenceOnTopologyData.m_puiAdditionalIndexes = puiAdditionalIndexes;
A3DMiscReferenceOnTopology* pReferenceOnTopoItem;
CHECK_RET(A3DMiscReferenceOnTopologyCreate(&sReferenceOnTopologyData, &pReferenceOnTopoItem));
// create MarkupLinkedItem
CHECK_RET(stCreateLinkedItem(pReferenceOnTopoItem, pPOTarget, ppMLI));
return iRet;
}
A3DStatus createMarkupLinkedItemOnTess(A3DEntity* pEntity, A3DEEntityType eTessItemType,
A3DUns32 uiAdditionalIndexesSize,
A3DUns32* puiAdditionalIndexes,
A3DAsmProductOccurrence* pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI)
{
A3DStatus iRet = A3D_SUCCESS;
A3DMiscReferenceOnTessData sReferenceOnTessData;
A3D_INITIALIZE_DATA(A3DMiscReferenceOnTessData, sReferenceOnTessData);
sReferenceOnTessData.m_eTopoItemType = eTessItemType; // kA3DTypeTessFace / kA3DTypeTessEdge / kA3DTypeTessVertex;
sReferenceOnTessData.m_pPolyBrepModel = pEntity;
sReferenceOnTessData.m_pTargetProductOccurrence = pPOTarget;
sReferenceOnTessData.m_uiSize = uiAdditionalIndexesSize;
sReferenceOnTessData.m_puiAdditionalIndexes = puiAdditionalIndexes;
A3DMiscReferenceOnTess* pReferenceOnTessItem;
CHECK_RET(A3DMiscReferenceOnTessCreate(&sReferenceOnTessData, &pReferenceOnTessItem));
*ppMLI = (A3DMiscMarkupLinkedItem*)pReferenceOnTessItem;
return iRet;
}

View File

@@ -0,0 +1,40 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateLinkedItem.cpp
* This file is containing the function allowing to create linked items.
*
*
***********************************************************************************************************************/
#pragma once
#include "../CreatePRCCubesDef.h"
#include "CreateGraphics.h"
//######################################################################################################################
A3DStatus createMarkupLinkedItemOnProduct(A3DAsmProductOccurrence* pPO, A3DAsmProductOccurrence *pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI);
A3DStatus createMarkupLinkedItemOnEntity(A3DEntity* pEntity, A3DAsmProductOccurrence *pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI);
A3DStatus createMarkupLinkedItemOnTopo(A3DEntity* pEntity, A3DEEntityType eTopoItemType,
A3DUns32 uiAdditionalIndexesSize,
A3DUns32* puiAdditionalIndexes,
A3DAsmProductOccurrence* pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI);
A3DStatus createMarkupLinkedItemOnTess(A3DEntity* pEntity, A3DEEntityType eTopoItemType,
A3DUns32 uiAdditionalIndexesSize,
A3DUns32* puiAdditionalIndexes,
A3DAsmProductOccurrence* pPOTarget,
A3DMiscMarkupLinkedItem ** ppMLI);

View File

@@ -0,0 +1,444 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateMartkups.cpp
* This file is containing the function allowing to create markups.
*
* Markups creation exemple
* Create tessellated markups with linked items.
* Different style of markups can be created (normal or face to screen).
* Different links to the PRC entities can be created as well.
*
* These exemples are using the tessellation wrapper: HXWMarkupTessellation.cpp
*
*
***********************************************************************************************************************/
#include "CreateMarkups.h"
#include "../tessellation_wrapper/HXWMarkupTessellation.h"
#include <vector>
//######################################################################################################################
//
// Tessellation Helper
//
//######################################################################################################################
// Create a leader and an arrow
static void stCreateLeaderTess(HXWMarkupTessellation* sMarkupLeaderTessellation, A3DVector3dData* pLeaderBegin, A3DVector3dData* pLeaderEnd)
{
// Leader
A3DDouble* pdLeaderPolylineData = (A3DDouble*) malloc(9 * sizeof(A3DDouble));
pdLeaderPolylineData[0] = pLeaderBegin->m_dX;
pdLeaderPolylineData[1] = pLeaderBegin->m_dY;
pdLeaderPolylineData[2] = pLeaderBegin->m_dZ;
pdLeaderPolylineData[3] = pdLeaderPolylineData[0];
pdLeaderPolylineData[4] = pdLeaderPolylineData[1];
pdLeaderPolylineData[5] = pLeaderEnd->m_dZ;
pdLeaderPolylineData[6] = pLeaderEnd->m_dX;
pdLeaderPolylineData[7] = pLeaderEnd->m_dY;
pdLeaderPolylineData[8] = pLeaderEnd->m_dZ;
sMarkupLeaderTessellation->set_color(YELLOW);
sMarkupLeaderTessellation->add_polyline(pdLeaderPolylineData, 3);
free(pdLeaderPolylineData);
// Arrow
A3DDouble* pdTriangle = (A3DDouble*) malloc(9 * sizeof(A3DDouble));
pdTriangle[0] = pLeaderBegin->m_dX;
pdTriangle[1] = pLeaderBegin->m_dY;
pdTriangle[2] = pLeaderBegin->m_dZ;
pdTriangle[3] = pdTriangle[0];
pdTriangle[4] = pdTriangle[1] - 3;
pdTriangle[5] = pdTriangle[2] + 6;
pdTriangle[6] = pdTriangle[0];
pdTriangle[7] = pdTriangle[1] + 3;
pdTriangle[8] = pdTriangle[2] + 6;
sMarkupLeaderTessellation->set_color(YELLOW);
sMarkupLeaderTessellation->add_triangle(pdTriangle);
free(pdTriangle);
}
//######################################################################################################################
// Create a Frame and Background
static void stCreateFrameTess(HXWMarkupTessellation* pMarkupTessellation,
A3DVector3dData* pBottomLeft, // this feel the most natural as text will begin from that point
A3DDouble width, A3DDouble height)
{
// Frame
A3DDouble* pdMarkupFrameData = (A3DDouble*) malloc(16 * sizeof(A3DDouble));
pdMarkupFrameData[0] = pBottomLeft->m_dX; // lower left corner
pdMarkupFrameData[1] = pBottomLeft->m_dY;
pdMarkupFrameData[2] = pBottomLeft->m_dZ;
pdMarkupFrameData[3] = pdMarkupFrameData[0] + width; // lower right corner
pdMarkupFrameData[4] = pdMarkupFrameData[1];
pdMarkupFrameData[5] = pdMarkupFrameData[2];
pdMarkupFrameData[6] = pdMarkupFrameData[0] + width; // upper right corner
pdMarkupFrameData[7] = pdMarkupFrameData[1] + height;
pdMarkupFrameData[8] = pdMarkupFrameData[2];
pdMarkupFrameData[9] = pdMarkupFrameData[0]; // upper left corner
pdMarkupFrameData[10] = pdMarkupFrameData[1] + height;
pdMarkupFrameData[11] = pdMarkupFrameData[2];
pdMarkupFrameData[12] = pdMarkupFrameData[0]; // lower left corner
pdMarkupFrameData[13] = pdMarkupFrameData[1];
pdMarkupFrameData[14] = pdMarkupFrameData[2];
pMarkupTessellation->set_color(RED);
pMarkupTessellation->add_polyline(pdMarkupFrameData, 5);
free(pdMarkupFrameData);
// Background
A3DDouble* pdMarkupBackGroundData = (A3DDouble*) malloc(12 * sizeof(A3DDouble));
pdMarkupBackGroundData[0] = pBottomLeft->m_dX; // lower left corner
pdMarkupBackGroundData[1] = pBottomLeft->m_dY;
pdMarkupBackGroundData[2] = pBottomLeft->m_dZ - 0.01;
pdMarkupBackGroundData[3] = pdMarkupBackGroundData[0] + width; // lower right corner
pdMarkupBackGroundData[4] = pdMarkupBackGroundData[1];
pdMarkupBackGroundData[5] = pdMarkupBackGroundData[2] - 0.01;;
pdMarkupBackGroundData[6] = pdMarkupBackGroundData[0] + width; // upper right corner
pdMarkupBackGroundData[7] = pdMarkupBackGroundData[1] + height;
pdMarkupBackGroundData[8] = pdMarkupBackGroundData[2] - 0.01;;
pdMarkupBackGroundData[9] = pdMarkupBackGroundData[0]; // upper left corner
pdMarkupBackGroundData[10] = pdMarkupBackGroundData[1] + height;
pdMarkupBackGroundData[11] = pdMarkupBackGroundData[2] - 0.01;;
pMarkupTessellation->set_color(WHITE);
pMarkupTessellation->add_polygons(pdMarkupBackGroundData, 4);
free(pdMarkupBackGroundData);
}
//######################################################################################################################
// Create a Text
static void stCreateText(HXWMarkupTessellation* pMarkupTessellation,
const A3DUTF8Char* pcText,
A3DVector3dData* pBottomLeft, A3DDouble width, A3DDouble height)
{
// Text
HXWVector3d position(pBottomLeft->m_dX + 5,
pBottomLeft->m_dY + 5,
pBottomLeft->m_dZ);
HXWVector3d normal(0., 0., 1.);
HXWVector3d x_direction(1., 0., 0.);
pMarkupTessellation->begin_matrix(position.m_data, normal.m_data, x_direction.m_data);
pMarkupTessellation->set_textfont("Courier New", 10, kA3DFontBold);
pMarkupTessellation->set_color(BLUE);
pMarkupTessellation->add_text(pcText, width, height);
pMarkupTessellation->end_matrix();
/* to test a second text
position.m_data.m_dX += width + 5;
pMarkupTessellation->begin_matrix(position.m_data, normal.m_data, x_direction.m_data);
pMarkupTessellation->set_textfont("Myriad CAD", 10, kA3DFontBold);
pMarkupTessellation->set_color(BLUE);
pMarkupTessellation->add_text("Publish");
pMarkupTessellation->end_matrix();
*/
}
//######################################################################################################################
//
// Leader, frame and text
//
//######################################################################################################################
static const double sdFrameWidth = 110;
static const double sdFrameHeight = 25;
static const double sdTextWidth = 100;
static const double sdTextHeight = 10;
// Create a Tessellation
static A3DStatus stCreateFrameAndText(A3DTessMarkup** ppTessMarkup,
const A3DUTF8Char* pcText,
A3DVector3dData* pFramePos)
{
A3DStatus iRet = A3D_SUCCESS;
// label
HXWMarkupTessellation sMarkupTessellation;
stCreateFrameTess(&sMarkupTessellation, pFramePos, sdFrameWidth, sdFrameHeight);
stCreateText(&sMarkupTessellation, pcText, pFramePos, sdTextWidth, sdTextHeight);
*ppTessMarkup = sMarkupTessellation.GetEntity();
return iRet;
}
// Create a Face to screen Tessellation
static A3DStatus stCreateFrameAndTextFaceToScreen(A3DTessMarkup** ppTessMarkup,
const A3DUTF8Char* pcText,
A3DVector3dData* pFrame3DPos,
FlatToScreenMode inFlatToScreenMode)
{
A3DStatus iRet = A3D_SUCCESS;
HXWMarkupTessellation sMarkupTessellation;
// FaceMode
A3DDouble pFaceModeOrigin[3];
pFaceModeOrigin[0] = pFrame3DPos->m_dX;
pFaceModeOrigin[1] = pFrame3DPos->m_dY;
pFaceModeOrigin[2] = pFrame3DPos->m_dZ;
A3DVector3dData sOrigin;
A3D_INITIALIZE_DATA(A3DVector3dData, sOrigin);
sOrigin.m_dX = 0;
sOrigin.m_dY = 0;
sOrigin.m_dZ = 0;
switch (inFlatToScreenMode)
{
case FlatToScreen:
sMarkupTessellation.BeginFaceView(pFaceModeOrigin);
break;
case FlatToScreenAlwaysOnTop:
sMarkupTessellation.BeginFaceViewAlwaysOnTop(pFaceModeOrigin);
break;
case FlatToScreenNonZoomable:
sMarkupTessellation.BeginFrameDraw(pFaceModeOrigin);
break;
}
stCreateFrameTess(&sMarkupTessellation, &sOrigin, sdFrameWidth, sdFrameHeight);
stCreateText(&sMarkupTessellation, pcText, &sOrigin, sdTextWidth, sdTextHeight);
switch (inFlatToScreenMode)
{
case FlatToScreen:
case FlatToScreenAlwaysOnTop:
sMarkupTessellation.EndFaceView();
break;
case FlatToScreenNonZoomable:
sMarkupTessellation.EndFrameDraw();
break;
}
*ppTessMarkup = sMarkupTessellation.GetEntity();
return iRet;
}
//######################################################################################################################
// Create a Leader Tessellation
static A3DStatus stCreateLeader(A3DMkpLeader** ppMkpLeader,
A3DVector3dData* pBeginLeaderPos,
A3DVector3dData* pEndLeaderPos)
{
A3DStatus iRet = A3D_SUCCESS;
// leader
HXWMarkupTessellation sMarkupLeaderTessellation;
stCreateLeaderTess(&sMarkupLeaderTessellation, pBeginLeaderPos, pEndLeaderPos);
A3DMkpLeaderData sMkpLeaderData;
A3D_INITIALIZE_DATA(A3DMkpLeaderData, sMkpLeaderData);
A3DTessMarkup* pLeaderTessMarkup = sMarkupLeaderTessellation.GetEntity();
sMkpLeaderData.m_pTessellation = pLeaderTessMarkup;
CHECK_RET(A3DMkpLeaderCreate(&sMkpLeaderData, ppMkpLeader));
return iRet;
}
//######################################################################################################################
static A3DStatus stCreateMkpMarkup(A3DMkpMarkup** ppMarkup,
A3DTessMarkup* pTessMarkup,
A3DUns32 uiMkpLeaderSize,
A3DMkpLeader** ppMkpLeader,
A3DUns32 uiMarkupLinkedItemSize,
A3DMiscMarkupLinkedItem** ppMarkupLinkedItem)
{
A3DStatus iRet = A3D_SUCCESS;
A3DMkpMarkupData sMarkupData;
A3D_INITIALIZE_DATA(A3DMkpMarkupData, sMarkupData);
sMarkupData.m_eType = kA3DMarkupTypeText;
sMarkupData.m_eSubType = kA3DMarkupSubTypeUnknown;
sMarkupData.m_uiLeadersSize = uiMkpLeaderSize;
sMarkupData.m_ppLeaders = ppMkpLeader;
sMarkupData.m_uiLinkedItemsSize = uiMarkupLinkedItemSize;
sMarkupData.m_ppLinkedItems = ppMarkupLinkedItem;
sMarkupData.m_pTessellation = pTessMarkup;
CHECK_RET(A3DMkpMarkupCreate(&sMarkupData, ppMarkup));
return iRet;
}
//######################################################################################################################
//
// Markups creation
//
//######################################################################################################################
// Tesselated Markup creation
//######################################################################################################################
// Tesselated Markup creation
A3DStatus createMarkup(A3DMkpAnnotationItem** ppOutAnnotItem,
const A3DUTF8Char* pcText,
A3DUns32 uiLinkedEntitySize,
A3DEntity** ppLinkedEntity,
A3DAsmProductOccurrence** ppPOTarget,
A3DVector3dData* pFramePos,
A3DVector3dData* pLeaderPos)
{
A3DStatus iRet = A3D_SUCCESS;
A3DMkpLeader* pMkpLeader = 0;
A3DUns32 uiMkpLeaderSize = 0;
if (pLeaderPos)
{
CHECK_RET(stCreateLeader(&pMkpLeader, pLeaderPos, pFramePos));
uiMkpLeaderSize = 1;
}
A3DTessMarkup* pTessMarkup = 0;
CHECK_RET(stCreateFrameAndText(&pTessMarkup, pcText, pFramePos));
// -----------------------------------------------------------
// creation of linked item
std::vector<A3DMiscMarkupLinkedItem*> vLinkedItems;
for (A3DUns32 i = 0; i < uiLinkedEntitySize; ++i)
{
A3DMiscMarkupLinkedItem* pMarkupLinkedItem = 0;
CHECK_RET(createMarkupLinkedItemOnEntity(ppLinkedEntity[i], ppPOTarget[i], &pMarkupLinkedItem));
vLinkedItems.push_back(pMarkupLinkedItem);
}
// -----------------------------------------------------------
// create a Markup from the MarkupTessData
A3DMkpMarkup* pMarkup = 0;
CHECK_RET(stCreateMkpMarkup(&pMarkup, pTessMarkup, uiMkpLeaderSize, &pMkpLeader, (A3DUns32)vLinkedItems.size(), &(vLinkedItems[0])));
vLinkedItems.clear();
// -----------------------------------------------------------
// Annotation item creation
A3DMkpAnnotationItemData sAnnotItemData;
A3D_INITIALIZE_DATA(A3DMkpAnnotationItemData, sAnnotItemData);
sAnnotItemData.m_pMarkup = pMarkup;
CHECK_RET(A3DMkpAnnotationItemCreate(&sAnnotItemData, ppOutAnnotItem));
return iRet;
}
//######################################################################################################################
// Tesselated Markup creation
// Only the linked item creation process will change from the normal sample markup.
A3DStatus createMarkupOnFace(A3DMkpAnnotationItem** ppOutAnnotItem,
const A3DUTF8Char* pcText,
A3DUns32 uiLinkedEntitySize,
A3DEntity** ppLinkedEntity,
A3DAsmProductOccurrence** ppPOTarget,
A3DUns32* puiFaceIndexes,
A3DVector3dData* pFramePos,
A3DVector3dData* pLeaderPos)
{
A3DStatus iRet = A3D_SUCCESS;
A3DMkpLeader* pMkpLeader = 0;
A3DUns32 uiMkpLeaderSize = 0;
if (pLeaderPos)
{
CHECK_RET(stCreateLeader(&pMkpLeader, pLeaderPos, pFramePos));
uiMkpLeaderSize = 1;
}
A3DTessMarkup* pTessMarkup = 0;
CHECK_RET(stCreateFrameAndText(&pTessMarkup, pcText, pFramePos));
// -----------------------------------------------------------
// creation of linked item on a face
std::vector<A3DMiscMarkupLinkedItem*> vLinkedItems;
for (A3DUns32 i = 0; i < uiLinkedEntitySize; ++i)
{
A3DMiscMarkupLinkedItem* pMarkupLinkedItem = 0;
CHECK_RET(createMarkupLinkedItemOnTess(ppLinkedEntity[i], kA3DTypeTessFace, 1, &puiFaceIndexes[i], ppPOTarget[i], &pMarkupLinkedItem));
vLinkedItems.push_back(pMarkupLinkedItem);
}
// -----------------------------------------------------------
// create a Markup from the MarkupTessData
A3DMkpMarkup* pMarkup = 0;
CHECK_RET(stCreateMkpMarkup(&pMarkup, pTessMarkup, uiMkpLeaderSize, &pMkpLeader, (A3DUns32)vLinkedItems.size(), &(vLinkedItems[0])));
vLinkedItems.clear();
// -----------------------------------------------------------
// Annotation item creation
A3DMkpAnnotationItemData sAnnotItemData;
A3D_INITIALIZE_DATA(A3DMkpAnnotationItemData, sAnnotItemData);
sAnnotItemData.m_pMarkup = pMarkup;
CHECK_RET(A3DMkpAnnotationItemCreate(&sAnnotItemData, ppOutAnnotItem));
return iRet;
}
//######################################################################################################################
// FaceMode Markup creation
A3DStatus createMarkupFaceToScreen(A3DMkpAnnotationItem** ppOutAnnotItem,
const A3DUTF8Char* pcText,
A3DUns32 uiLinkedEntitySize,
A3DEntity** ppLinkedEntity,
A3DAsmProductOccurrence** ppPOTarget,
A3DVector3dData* pFramePos,
FlatToScreenMode inFlatToScreenMode)
{
A3DStatus iRet = A3D_SUCCESS;
A3DTessMarkup* pTessMarkup = 0;
CHECK_RET(stCreateFrameAndTextFaceToScreen(&pTessMarkup, pcText, pFramePos, inFlatToScreenMode));
// -----------------------------------------------------------
// creation of linked item
// creation of linked item
std::vector<A3DMiscMarkupLinkedItem*> vLinkedItems;
for (A3DUns32 i = 0; i < uiLinkedEntitySize; ++i)
{
A3DMiscMarkupLinkedItem* pMarkupLinkedItem = 0;
CHECK_RET(createMarkupLinkedItemOnEntity(ppLinkedEntity[i], ppPOTarget[i], &pMarkupLinkedItem));
vLinkedItems.push_back(pMarkupLinkedItem);
}
// -----------------------------------------------------------
// create a Markup from the MarkupTessData
A3DMkpMarkup* pMarkup = 0;
CHECK_RET(stCreateMkpMarkup(&pMarkup, pTessMarkup, 0, 0, (A3DUns32)vLinkedItems.size(), &(vLinkedItems[0])));
vLinkedItems.clear();
// -----------------------------------------------------------
// Annotation item creation
A3DMkpAnnotationItemData sAnnotItemData;
A3D_INITIALIZE_DATA(A3DMkpAnnotationItemData, sAnnotItemData);
sAnnotItemData.m_pMarkup = pMarkup;
CHECK_RET(A3DMkpAnnotationItemCreate(&sAnnotItemData, ppOutAnnotItem));
return iRet;
}

View File

@@ -0,0 +1,69 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateMartkups.cpp
* This file is containing the function allowing to create markups.
*
* Markups creation exemple
* Create tessellated markups with linked items.
* Different style of markups can be created (normal or face to screen).
* Different links to the PRC entities can be created as well.
*
* These exemples are using the tessellation wrapper: HXWMarkupTessellation.cpp
*
*
***********************************************************************************************************************/
#pragma once
#include "../CreatePRCCubesDef.h"
#include "CreateLinkedItem.h"
#include "CreateGraphics.h"
//######################################################################################################################
enum FlatToScreenMode
{
FlatToScreen,
FlatToScreenAlwaysOnTop,
FlatToScreenNonZoomable
};
//######################################################################################################################
// Tesselated Markup creation with Publish
A3DStatus createMarkup(A3DMkpAnnotationItem** ppOutAnnotItem,
const A3DUTF8Char* pcText,
A3DUns32 uiLinkedEntitySize,
A3DEntity** ppLinkedEntity,
A3DAsmProductOccurrence** ppPOTarget,
A3DVector3dData* pFramePos,
A3DVector3dData* pLeaderPos = 0);
A3DStatus createMarkupOnFace(A3DMkpAnnotationItem** ppOutAnnotItem,
const A3DUTF8Char* pcText,
A3DUns32 uiLinkedEntitySize,
A3DEntity** ppLinkedEntity,
A3DAsmProductOccurrence** ppPOTarget,
A3DUns32* puiFaceIndexes,
A3DVector3dData* pFramePos,
A3DVector3dData* pLeaderPos = 0);
A3DStatus createMarkupFaceToScreen(A3DMkpAnnotationItem** ppOutAnnotItem,
const A3DUTF8Char* pcText,
A3DUns32 uiLinkedEntitySize,
A3DEntity** ppLinkedEntity,
A3DAsmProductOccurrence** ppPOTarget,
A3DVector3dData* pFramePos,
FlatToScreenMode inFlatToScreenMode = FlatToScreen);

View File

@@ -0,0 +1,161 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateTextures.cpp
* This file is containing the function allowing to create Textures.
*
* Texture creation exemple
* Create the style corresponding to texture.
*
*
***********************************************************************************************************************/
#include "CreateTextures.h"
#ifdef WIN32
# include <sys/stat.h>
#else
# include <sys/types.h> /* stat */
# include <sys/stat.h>
# include <unistd.h>
#endif
//######################################################################################################################
// Picture creation
static A3DStatus stFillBinaryDataWithFile(const A3DUTF8Char* pcPictureFilePath, A3DUns8*& pcBinaryData, A3DUns32& iFileSize)
{
A3DStatus iRet = A3D_SUCCESS;
FILE* psFile = fopen(pcPictureFilePath, "rb");
if(psFile == NULL)
return A3D_ERROR;
#ifdef WIN32
struct _stat ficstat;
iRet = (A3DStatus) _stat(pcPictureFilePath, &ficstat);
#else
struct stat ficstat;
# if defined(Apple) && defined(_UNICODE)
USES_CONVERSION;
iRet = (stat(W2A(pcPictureFilePath), &ficstat) == 0 ? A3D_SUCCESS : A3D_ERROR);
# else
iRet = (stat(pcPictureFilePath, &ficstat) == 0 ? A3D_SUCCESS : A3D_ERROR);
# endif
#endif
if (iRet != A3D_SUCCESS || ficstat.st_size == 0)
{
fclose(psFile);
return A3D_ERROR;
}
iFileSize = ficstat.st_size;
pcBinaryData = (A3DUns8*)malloc(iFileSize * A3DUns32(sizeof(A3DUns8)));
fread(pcBinaryData, sizeof(unsigned char), size_t(iFileSize), psFile);
fclose(psFile);
return A3D_SUCCESS;
}
//######################################################################################################################
static A3DStatus stCreatePicture(const A3DUTF8Char* pcPictureFilePath, A3DEPictureDataFormat eFormat,
A3DUns32 uiPixelHeight, A3DUns32 uiPixelWidth, A3DUns32& uiPictureIndex)
{
A3DStatus iRet = A3D_SUCCESS;
// For supported PRC image type, the sizes should be 0 as they are stored in the data
A3DGraphPictureData sPictureData;
A3D_INITIALIZE_DATA(A3DGraphPictureData, sPictureData);
sPictureData.m_eFormat = eFormat;
sPictureData.m_uiPixelHeight = uiPixelHeight;
sPictureData.m_uiPixelWidth = uiPixelWidth;
CHECK_RET(stFillBinaryDataWithFile(pcPictureFilePath, sPictureData.m_pucBinaryData, sPictureData.m_uiSize));
CHECK_RET(A3DGlobalInsertGraphPicture(&sPictureData, &uiPictureIndex));
free(sPictureData.m_pucBinaryData);
return iRet;
}
//######################################################################################################################
// Texture creation
A3DStatus createTexture(const A3DUTF8Char* pcPictureFilePath, A3DEPictureDataFormat eFormat, A3DUns32 uiPixelHeight, A3DUns32 uiPixelWidth, A3DUns32& uiStyleIndex)
{
A3DStatus iRet = A3D_SUCCESS;
A3DUns32 uiPictureIndex;
CHECK_RET(stCreatePicture(pcPictureFilePath, eFormat, uiPixelHeight, uiPixelWidth, uiPictureIndex));
A3DUns32 uiMaterialGenericIndex;
CHECK_RET(createMaterial(uiMaterialGenericIndex, DARK_GREY));
A3DGraphTextureDefinitionData sTextureDefinitionData;
A3D_INITIALIZE_DATA(A3DGraphTextureDefinitionData, sTextureDefinitionData);
sTextureDefinitionData.m_uiMappingAttributes = kA3DTextureMappingDiffuse;
sTextureDefinitionData.m_ucTextureDimension = 2;
sTextureDefinitionData.m_eMappingType = kA3DTextureMappingTypeStored;
sTextureDefinitionData.m_eMappingOperator = kA3DTextureMappingOperatorUnknown;
sTextureDefinitionData.m_uiPictureIndex = uiPictureIndex;
sTextureDefinitionData.m_eTextureWrappingModeS = kA3DTextureWrappingModeClampToBorder;
sTextureDefinitionData.m_eTextureWrappingModeT = kA3DTextureWrappingModeClampToBorder;
sTextureDefinitionData.m_eTextureFunction = kA3DTextureFunctionModulate;
sTextureDefinitionData.m_dRed = 0.0;
sTextureDefinitionData.m_dGreen = 0.0;
sTextureDefinitionData.m_dBlue = 0.0;
sTextureDefinitionData.m_dAlpha = 0.0;
sTextureDefinitionData.m_eBlend_src_RGB = kA3DTextureBlendParameterUnknown;
sTextureDefinitionData.m_eBlend_dst_RGB = kA3DTextureBlendParameterUnknown;
sTextureDefinitionData.m_eBlend_src_Alpha = kA3DTextureBlendParameterUnknown;
sTextureDefinitionData.m_eBlend_dst_Alpha = kA3DTextureBlendParameterUnknown;
sTextureDefinitionData.m_ucTextureApplyingMode = kA3DTextureApplyingModeNone;
sTextureDefinitionData.m_eTextureAlphaTest = kA3DTextureAlphaTestUnknown;
sTextureDefinitionData.m_dAlphaTestReference = 0.0;
A3DUns32 uiIndexTextureDefinition;
CHECK_RET(A3DGlobalInsertGraphTextureDefinition(&sTextureDefinitionData, &uiIndexTextureDefinition));
free(sTextureDefinitionData.m_pdMappingAttributesIntensity);
CHECK_RET(iRet);
A3DGraphTextureApplicationData sTextureApplicationData;
A3D_INITIALIZE_DATA(A3DGraphTextureApplicationData, sTextureApplicationData);
sTextureApplicationData.m_uiMaterialIndex = uiMaterialGenericIndex;
sTextureApplicationData.m_uiTextureDefinitionIndex = uiIndexTextureDefinition;
sTextureApplicationData.m_iUVCoordinatesIndex = 0;
sTextureApplicationData.m_uiNextTextureApplicationIndex = A3D_DEFAULT_MATERIAL_INDEX;
A3DUns32 uiTextureApplicationIndex;
CHECK_RET(A3DGlobalInsertGraphTextureApplication(&sTextureApplicationData, &uiTextureApplicationIndex));
// LinePattern is mandatory
A3DUns32 uiLinePatternIndex;
A3DGraphLinePatternData sLinePatternData;
A3D_INITIALIZE_DATA(A3DGraphLinePatternData, sLinePatternData);
sLinePatternData.m_uiNumberOfLengths = 2;
sLinePatternData.m_pdLengths =
(A3DDouble*)malloc(sLinePatternData.m_uiNumberOfLengths * A3DUns32(sizeof(A3DDouble)));
sLinePatternData.m_pdLengths[0] = 10000.0;
sLinePatternData.m_pdLengths[1] = 0.0;
sLinePatternData.m_dPhase = 0.0;
sLinePatternData.m_bRealLength = true;
CHECK_RET(A3DGlobalInsertGraphLinePattern(&sLinePatternData, &uiLinePatternIndex));
free(sLinePatternData.m_pdLengths);
CHECK_RET(iRet);
A3DGraphStyleData sStyleData;
A3D_INITIALIZE_DATA(A3DGraphStyleData, sStyleData);
sStyleData.m_bMaterial = true;
sStyleData.m_bVPicture = false;
sStyleData.m_dWidth = 0.1; // default
sStyleData.m_ucTransparency = 255;
sStyleData.m_uiLinePatternIndex = uiLinePatternIndex;
sStyleData.m_uiRgbColorIndex = uiTextureApplicationIndex;
CHECK_RET(A3DGlobalInsertGraphStyle(&sStyleData, &uiStyleIndex));
return iRet;
}

View File

@@ -0,0 +1,30 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateTextures.cpp
* This file is containing the function allowing to create textures.
*
* Texture creation exemple
* Create the style corresponding to texture.
*
*
***********************************************************************************************************************/
#pragma once
#include "../CreatePRCCubesDef.h"
#include "CreateGraphics.h"
//######################################################################################################################
// Create the style corresponding to texture.
A3DStatus createTexture(const A3DUTF8Char* pcPictureFilePath, A3DEPictureDataFormat eFormat, A3DUns32 uiPixelHeight, A3DUns32 uiPixelWidth, A3DUns32& uiStyleIndex);

View File

@@ -0,0 +1,275 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateViews.cpp
* This file is containing the function allowing to create views.
*
* The function createView contains a lot of optionnal elements that function as so:
*
* If pCameraPos and pCameraLookAt are defined: function stiA3DGraphSceneDisplayParametersDataAddCamera
* is used to create a camera placement.
*
* If inGraphicsData is defined: linked item will be created in order to, at view activation,
* apply the graphic behavior on the POs defined by ppLinkedPOs.
*
* If ppAnnotations are defined: the designated annotation will not be hidden at view activation.
*
*
***********************************************************************************************************************/
#include "CreateViews.h"
#include <vector>
//######################################################################################################################
// Camera creation
static int stiA3DGraphSceneDisplayParametersDataAddCamera(A3DGraphSceneDisplayParametersData& sGraphSceneDisplayParametersData,
A3DVector3dData& sCameraPos,
A3DVector3dData& sCameraLookAt,
A3DDouble dXFovy, A3DDouble dYFovy)
{
A3DGraphCameraData sData;
A3DGraphCamera* pCamera = NULL;
A3D_INITIALIZE_DATA(A3DGraphCameraData, sData);
sData.m_bOrthographic = true;
sData.m_dAspectRatio = 1;
sData.m_dZNear = 0.;
sData.m_dZFar = 2. * INFINITE_COORD;
sData.m_dXFovy = (dXFovy == -1.) ? stCameraFovX : dXFovy;
sData.m_dYFovy = (dYFovy == -1.) ? stCameraFovY : dYFovy;
sData.m_sLookAt.m_dX = sCameraLookAt.m_dX;
sData.m_sLookAt.m_dY = sCameraLookAt.m_dY;
sData.m_sLookAt.m_dZ = sCameraLookAt.m_dZ;
sData.m_sLocation.m_dX = sCameraPos.m_dX;
sData.m_sLocation.m_dY = sCameraPos.m_dY;
sData.m_sLocation.m_dZ = sCameraPos.m_dZ;
sData.m_sUp.m_dX = 0.;
sData.m_sUp.m_dY = 1.;
sData.m_sUp.m_dZ = 0.;
if (A3DGraphCameraCreate(&sData, &pCamera) != A3D_SUCCESS)
return A3D_ERROR;
sGraphSceneDisplayParametersData.m_pCamera = pCamera;
return A3D_SUCCESS;
}
//######################################################################################################################
//######################################################################################################################
A3DStatus setViewCameraPlacement(A3DMkpViewData* pMkpViewData,
A3DVector3dData* pCameraPos,
A3DVector3dData* pCameraLookAt,
A3DDouble dXFovy, A3DDouble dYFovy)
{
A3DStatus iRet = A3D_SUCCESS;
if (pCameraPos && pCameraLookAt)
{
A3DGraphSceneDisplayParametersData sGraphSceneDisplayParametersData;
A3D_INITIALIZE_DATA(A3DGraphSceneDisplayParametersData, sGraphSceneDisplayParametersData);
sGraphSceneDisplayParametersData.m_uiBackgroundStyleIndex = A3D_DEFAULT_STYLE_INDEX;
stiA3DGraphSceneDisplayParametersDataAddCamera(sGraphSceneDisplayParametersData, *pCameraPos, *pCameraLookAt, dXFovy, dYFovy);
CHECK_RET(A3DGraphSceneDisplayParametersCreate(&sGraphSceneDisplayParametersData, &pMkpViewData->m_pSceneDisplayParameters));
}
return iRet;
}
//######################################################################################################################
A3DStatus addViewLinkedItem(A3DMkpViewData* pMkpViewData,
A3DUns32 uiLinkedItemsSize,
A3DMiscMarkupLinkedItem** ppLinkedItems)
{
A3DStatus iRet = A3D_SUCCESS;
std::vector<A3DMiscMarkupLinkedItem*> vpMarkupLinkedItems;
// copy previous linked item of view.
for (A3DUns32 i = 0; i < pMkpViewData->m_uiLinkedItemsSize; ++i)
{
vpMarkupLinkedItems.push_back(pMkpViewData->m_ppLinkedItems);
}
// add the new ones
for (A3DUns32 i = 0; i < uiLinkedItemsSize; ++i)
{
vpMarkupLinkedItems.push_back(ppLinkedItems[i]);
}
// replace the data
pMkpViewData->m_uiLinkedItemsSize = (A3DUns32)vpMarkupLinkedItems.size();
pMkpViewData->m_ppLinkedItems = (A3DMiscMarkupLinkedItem**) malloc(pMkpViewData->m_uiLinkedItemsSize * A3DUns32(sizeof(A3DMiscMarkupLinkedItem*)));
for (A3DUns32 i = 0; i < pMkpViewData->m_uiLinkedItemsSize; ++i)
{
pMkpViewData->m_ppLinkedItems[i] = vpMarkupLinkedItems[i];
}
return iRet;
}
//######################################################################################################################
A3DStatus setIsDefaultView(A3DMkpViewData* pMkpViewData,
A3DBool bIsDefaultView)
{
A3DStatus iRet = A3D_SUCCESS;
pMkpViewData->m_bIsDefaultView = bIsDefaultView;
return iRet;
}
//######################################################################################################################
A3DStatus setViewEntitiesOffsetPosition(A3DMkpViewData* pMkpViewData,
A3DUns32 uiLinkedPOsSize,
A3DAsmProductOccurrence** ppLinkedPOs,
A3DMiscCartesianTransformation** ppOffsetTransformation)
{
A3DStatus iRet = A3D_SUCCESS;
std::vector<A3DMiscMarkupLinkedItem*> vpMarkupLinkedItems;
// create new Linked items pointing to entity with new coordinates systems
for (A3DUns32 i = 0; i < uiLinkedPOsSize; ++i)
{
// create a linked item pointing to the entity
A3DMiscMarkupLinkedItem* pLinkedItem = 0;
CHECK_RET(createMarkupLinkedItemOnProduct(ppLinkedPOs[i], NULL, &pLinkedItem));
// create the new coordinate system
// add the offset to every PO current position
A3DAsmProductOccurrenceData sPOData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sPOData);
CHECK_RET(A3DAsmProductOccurrenceGet(ppLinkedPOs[i], &sPOData));
A3DMiscCartesianTransformationData sPOTransformationData;
A3D_INITIALIZE_DATA(A3DMiscCartesianTransformationData, sPOTransformationData);
CHECK_RET(A3DMiscCartesianTransformationGet(sPOData.m_pLocation, &sPOTransformationData));
A3DMiscCartesianTransformation* pOffsetTransformation = 0;
A3DMiscCartesianTransformationData sOffsetTransformationData;
A3D_INITIALIZE_DATA(A3DMiscCartesianTransformationData, sOffsetTransformationData);
CHECK_RET(A3DMiscCartesianTransformationGet(ppOffsetTransformation[i], &sOffsetTransformationData));
sOffsetTransformationData.m_sOrigin.m_dX += sPOTransformationData.m_sOrigin.m_dX;
sOffsetTransformationData.m_sOrigin.m_dY += sPOTransformationData.m_sOrigin.m_dY;
sOffsetTransformationData.m_sOrigin.m_dZ += sPOTransformationData.m_sOrigin.m_dZ;
CHECK_RET(A3DMiscCartesianTransformationCreate(&sOffsetTransformationData, &pOffsetTransformation));
//create a CoordSystem
A3DRiCoordinateSystem* pCoordinateSystem = 0;
A3DRiCoordinateSystemData sCoordinateSystemData;
A3D_INITIALIZE_DATA(A3DRiCoordinateSystemData, sCoordinateSystemData);
sCoordinateSystemData.m_pTransformation = pOffsetTransformation;
CHECK_RET(A3DRiCoordinateSystemCreate(&sCoordinateSystemData, &pCoordinateSystem));
//Create a A3DMiscEntityReference with the coordinates
A3DMiscEntityReferenceData sMiscEntityRefData;
A3D_INITIALIZE_DATA(A3DMiscEntityReferenceData, sMiscEntityRefData);
sMiscEntityRefData.m_pEntity = ppLinkedPOs[i];
sMiscEntityRefData.m_pCoordinateSystem = pCoordinateSystem;
//Attach A3DMiscEntityReference to the MkpLinkedItem previously created, pointing to entity
CHECK_RET(A3DMiscEntityReferenceSet(pLinkedItem, &sMiscEntityRefData));
vpMarkupLinkedItems.push_back(pLinkedItem);
}
CHECK_RET(addViewLinkedItem(pMkpViewData, (A3DUns32)vpMarkupLinkedItems.size(), &vpMarkupLinkedItems[0]));
return iRet;
}
//######################################################################################################################
A3DStatus setViewEntitiesGraphics(A3DMkpViewData* pMkpViewData,
A3DUns32 uiLinkedPOsSize,
A3DAsmProductOccurrence** ppLinkedPOs,
A3DRootBaseWithGraphicsData* inGraphicsData)
{
A3DStatus iRet = A3D_SUCCESS;
std::vector<A3DMiscMarkupLinkedItem*> vpMarkupLinkedItems;
// create new Linked items pointing to entity with graphics
for (A3DUns32 i = 0; i < uiLinkedPOsSize; ++i)
{
// create a linked item pointing to the entity
A3DMiscMarkupLinkedItem* pLinkedItem = 0;
CHECK_RET(createMarkupLinkedItemOnProduct(ppLinkedPOs[i], NULL, &pLinkedItem));
// add the graphic to the linked item
CHECK_RET(A3DRootBaseWithGraphicsSet(pLinkedItem, inGraphicsData));
vpMarkupLinkedItems.push_back(pLinkedItem);
}
CHECK_RET(addViewLinkedItem(pMkpViewData, (A3DUns32)vpMarkupLinkedItems.size(), &vpMarkupLinkedItems[0]));
return iRet;
}
//######################################################################################################################
// The following function is only to be used when the annotations are owned by the same PO as the view will be.
A3DStatus setViewAnnotations(A3DMkpViewData* pMkpViewData,
A3DUns32 uiAnnotationsSize,
A3DMkpAnnotationEntity ** ppAnnotations)
{
A3DStatus iRet = A3D_SUCCESS;
pMkpViewData->m_uiAnnotationsSize = uiAnnotationsSize;
pMkpViewData->m_ppAnnotations = ppAnnotations;
return iRet;
}
// The following function is to be used when the annotations are owned by the PO that is a child of the PO that own the view.
A3DStatus setViewAnnotations(A3DMkpViewData* pMkpViewData,
A3DUns32 uiAnnotationsSize,
A3DMkpAnnotationEntity ** ppAnnotations,
A3DAsmProductOccurrence** ppPOOwners)
{
A3DStatus iRet = A3D_SUCCESS;
std::vector<A3DMiscMarkupLinkedItem*> vpMarkupLinkedItems;
// create new Linked items pointing to annotation
for (A3DUns32 i = 0; i < uiAnnotationsSize; ++i)
{
// create a linked item pointing to the annotation
// note that the PO owner of the annotation should be set.
A3DMiscMarkupLinkedItem* pLinkedItem = 0;
CHECK_RET(createMarkupLinkedItemOnEntity(ppAnnotations[i], ppPOOwners[i], &pLinkedItem));
vpMarkupLinkedItems.push_back(pLinkedItem);
}
CHECK_RET(addViewLinkedItem(pMkpViewData, (A3DUns32)vpMarkupLinkedItems.size(), &vpMarkupLinkedItems[0]));
return iRet;
}
//######################################################################################################################
A3DStatus createView(A3DMkpView** ppOutMkupView,
A3DMkpViewData* pMkpViewData,
const A3DUTF8Char* inName)
{
A3DStatus iRet = A3D_SUCCESS;
CHECK_RET(A3DMkpViewCreate(pMkpViewData, ppOutMkupView));
setEntityName(*ppOutMkupView, inName);
return iRet;
}

View File

@@ -0,0 +1,74 @@
/***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************/
/**
* Sample CreatePRCCubes
* file CreateViews.cpp
* This file is containing the function allowing to create views with optionnal elements.
*
*
*
*
***********************************************************************************************************************/
#pragma once
#include "../CreatePRCCubesDef.h"
#include "CreateLinkedItem.h"
#include "CreateGraphics.h"
//######################################################################################################################
static const double stCameraFovX = 1000;
static const double stCameraFovY = 1000;
static const A3DVector3dData stCameraPosDefault = {0, 2000, 0, 0};
static const A3DVector3dData stCameraLookAtDefault = { 0, 300, 1050, 1050 };
//######################################################################################################################
A3DStatus setViewCameraPlacement(A3DMkpViewData* pMkpViewData,
A3DVector3dData* pCameraPos,
A3DVector3dData* pCameraLookAt,
A3DDouble dXFovy, A3DDouble dYFovy);
A3DStatus addViewLinkedItem(A3DMkpViewData* pMkpViewData,
A3DUns32 uiLinkedItemsSize,
A3DMiscMarkupLinkedItem** ppLinkedItems);
A3DStatus setIsDefaultView(A3DMkpViewData* pMkpViewData,
A3DBool bIsDefaultView);
A3DStatus setViewEntitiesOffsetPosition(A3DMkpViewData* pMkpViewData,
A3DUns32 uiLinkedPOsSize,
A3DAsmProductOccurrence** ppLinkedPOs,
A3DMiscCartesianTransformation** ppOffsetTransformation);
A3DStatus setViewEntitiesGraphics(A3DMkpViewData* pMkpViewData,
A3DUns32 uiLinkedPOsSize,
A3DAsmProductOccurrence** ppLinkedPOs,
A3DRootBaseWithGraphicsData* inGraphicsData);
// The following function is only to be used when the annotations are owned by the same PO as the view will be.
A3DStatus setViewAnnotations(A3DMkpViewData* pMkpViewData,
A3DUns32 uiAnnotationsSize,
A3DMkpAnnotationEntity ** ppAnnotations);
// The following function is to be used when the annotations are owned by the PO that is a child of the PO that own the view.
A3DStatus setViewAnnotations(A3DMkpViewData* pMkpViewData,
A3DUns32 uiAnnotationsSize,
A3DMkpAnnotationEntity ** ppAnnotations,
A3DAsmProductOccurrence** ppPOOwners);
A3DStatus createView(A3DMkpView** ppOutMkupView,
A3DMkpViewData* pMkpViewData,
const A3DUTF8Char* inName);

View File

@@ -0,0 +1,112 @@
/***********************************************************************************************************************
*
* 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 wrapper/HXWBasicTessellation.cpp
***********************************************************************************************************************/
#include <A3DSDKIncludes.h>
#include "HXWBasicTessellation.h"
//######################################################################################################################
HXWBasicTessellation::HXWBasicTessellation()
{
A3D_INITIALIZE_DATA(A3DTessBaseData, m_coordsdata);
m_coordsdata.m_pdCoords = NULL;
m_coordsdata.m_uiCoordSize = m_uiCoordsAllocated = 0;
}
//######################################################################################################################
HXWBasicTessellation::~HXWBasicTessellation()
{
A3D_INITIALIZE_DATA(A3DTessBaseData, m_coordsdata);
reset();
}
//######################################################################################################################
void HXWBasicTessellation::reset()
{
free(m_coordsdata.m_pdCoords);
m_coordsdata.m_pdCoords = NULL;
m_coordsdata.m_uiCoordSize = m_uiCoordsAllocated = 0;
}
//######################################################################################################################
void HXWBasicTessellation::add_coords(A3DDouble* pdCoords, A3DUns32 uiCoordsSize)
{
if(m_uiCoordsAllocated == 0)
{
m_uiCoordsAllocated = ALLOCATION_STEP + uiCoordsSize;
m_coordsdata.m_pdCoords = (A3DDouble*) malloc((size_t) m_uiCoordsAllocated * sizeof(A3DDouble));
}
else if(!(uiCoordsSize + m_coordsdata.m_uiCoordSize < m_uiCoordsAllocated))
{
m_uiCoordsAllocated = uiCoordsSize + m_coordsdata.m_uiCoordSize + ALLOCATION_STEP;
A3DDouble* temp = (A3DDouble*) malloc((size_t) m_uiCoordsAllocated * sizeof(A3DDouble));
memcpy(temp, m_coordsdata.m_pdCoords, (size_t) m_coordsdata.m_uiCoordSize * sizeof(A3DDouble));
if(m_coordsdata.m_pdCoords != NULL)
{
free(m_coordsdata.m_pdCoords);
m_coordsdata.m_pdCoords = NULL;
}
m_coordsdata.m_pdCoords = temp;
}
m_coordsdata.m_uiCoordSize += uiCoordsSize;
for(unsigned i = 0 ; i < uiCoordsSize; ++i)
m_coordsdata.m_pdCoords[m_coordsdata.m_uiCoordSize-uiCoordsSize+i] = pdCoords[i];
}
//######################################################################################################################
void HXWBasicTessellation::add_coord(A3DDouble dCoord)
{
if(m_uiCoordsAllocated == 0)
{
m_coordsdata.m_pdCoords = (A3DDouble*) malloc(ALLOCATION_STEP * sizeof(A3DDouble));
m_uiCoordsAllocated = ALLOCATION_STEP;
}
else if(!(m_coordsdata.m_uiCoordSize + 1< m_uiCoordsAllocated))
{
m_uiCoordsAllocated = m_coordsdata.m_uiCoordSize + ALLOCATION_STEP;
A3DDouble* temp =(A3DDouble*) malloc((size_t) m_uiCoordsAllocated * sizeof(A3DDouble));
memcpy(temp, m_coordsdata.m_pdCoords, (size_t) m_coordsdata.m_uiCoordSize * sizeof(A3DDouble));
if(m_coordsdata.m_pdCoords != NULL)
{
free(m_coordsdata.m_pdCoords);
m_coordsdata.m_pdCoords = NULL;
}
m_coordsdata.m_pdCoords = temp;
}
m_coordsdata.m_pdCoords[m_coordsdata.m_uiCoordSize++] = dCoord;
}
//######################################################################################################################
void HXWBasicTessellation::free_extra_coords()
{
if(m_coordsdata.m_uiCoordSize == m_uiCoordsAllocated)
return;
A3DDouble* pnew = NULL;
if(m_coordsdata.m_uiCoordSize != 0)
{
pnew = (A3DDouble*) malloc((size_t) m_coordsdata.m_uiCoordSize * sizeof(A3DDouble));
memcpy(pnew, m_coordsdata.m_pdCoords, (size_t) m_coordsdata.m_uiCoordSize * sizeof(A3DDouble));
}
if(m_coordsdata.m_pdCoords != NULL)
{
free(m_coordsdata.m_pdCoords);
m_coordsdata.m_pdCoords = NULL;
}
m_coordsdata.m_pdCoords = pnew;
m_uiCoordsAllocated = m_coordsdata.m_uiCoordSize;
}

View File

@@ -0,0 +1,58 @@
/***********************************************************************************************************************
*
* 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 wrapper/HXWBasicTessellation.h
Header file for the wrapper Tessellation module.
***********************************************************************************************************************/
#include "HXWEntity.h"
#include <stdlib.h>
/*!
\defgroup wrapper_tessellation_module Tessellation Module
\ingroup wrapper_module
Entity type is \ref HXWBasicTessellation.
*/
/*! \class HXWBasicTessellation HXWBasicTessellation.h "HXWBasicTessellation.h"
* \brief This is a tessellation builder.
* \ingroup wrapper_tessellation_module
*/
class HXWBasicTessellation: public HXWEntity
{
protected:
static const int ALLOCATION_STEP = 5; /*! step in allocation or reallocation array of coords, codes, etc. */
protected:
A3DTessBaseData m_coordsdata; /*!< tessellation that is built */
A3DUns32 m_uiCoordsAllocated;
protected:
A3DPtr my_alloc(A3DUns32 uiSize) { return malloc((size_t) uiSize); } /*!< allocation for A3DTessBaseData */
A3DVoid my_free(A3DPtr ptr) { free(ptr); ptr = NULL; } /*!< free for A3DTessBaseData */
public:
HXWBasicTessellation();
~HXWBasicTessellation();
protected:
void add_coord(A3DDouble dCoord); /*!< add one double in tessellation */
void add_coords(A3DDouble* pdCoords, A3DUns32 uiCoordsSize); /*!< add an array of doubles in tessellation */
virtual void reset(); /*!< reset of doubles in tessellation */
void free_extra_coords(); /*!< to manage extra allocations */
public:
/*!< set the tessellation in exchange owner structure */
inline int SetCoords(A3DTessBase* pTessMarkup) { return A3DTessBaseSet(pTessMarkup,&m_coordsdata); }
};

View File

@@ -0,0 +1,29 @@
/***********************************************************************************************************************
*
* 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 wrapper/HXWEntity.cpp
***********************************************************************************************************************/
#include <A3DSDKIncludes.h>
#include "HXWEntity.h"
//######################################################################################################################
HXWEntity::HXWEntity()
{
}
//######################################################################################################################
HXWEntity::~HXWEntity()
{
}

View File

@@ -0,0 +1,53 @@
/***********************************************************************************************************************
*
* 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 wrapper/HXWEntity.h
Header file for the wrapper Tessellation module.
***********************************************************************************************************************/
#define ERR_RET(TEST) { if(TEST != A3D_SUCCESS) return A3D_ERROR; }
/*!
\defgroup wrapper_module Wrapper Module
*/
class HXWVector3d
{
public:
A3DVector3dData m_data;
public:
HXWVector3d(double dx, double dy, double dz)
{
A3D_INITIALIZE_DATA(A3DVector3dData, m_data);
m_data.m_dX = dx;
m_data.m_dY = dy;
m_data.m_dZ = dz;
}
~HXWVector3d() {};
};
/*! \class HXWEntity HXWEntity.h "HXWEntity.h"
* \ingroup wrapper_module
*/
class HXWEntity
{
public:
HXWEntity();
~HXWEntity();
public:
virtual A3DEntity* GetEntity() = 0;
};

View File

@@ -0,0 +1,556 @@
/***********************************************************************************************************************
*
* 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 wrapper/HXWMarkupTessellation.cpp
***********************************************************************************************************************/
#include <A3DSDKIncludes.h>
#include "HXWMarkupTessellation.h"
#include <cmath>
//######################################################################################################################
HXWMarkupTessellation::HXWMarkupTessellation()
{
A3D_INITIALIZE_DATA(A3DTessMarkupData, m_data);
m_data.m_puiCodes = NULL;
m_data.m_ppcTexts = NULL;
m_data.m_uiCodesSize = m_uiAllocatedCodes = 0;
m_data.m_uiTextsSize = m_uiAllocatedTexts = 0;
}
//######################################################################################################################
HXWMarkupTessellation::~HXWMarkupTessellation()
{
reset();
}
//######################################################################################################################
A3DEntity* HXWMarkupTessellation::GetEntity()
{
A3DTessMarkup* pTessMarkup;
GetMarkupTess(pTessMarkup);
return pTessMarkup;
}
//######################################################################################################################
void HXWMarkupTessellation::reset()
{
HXWBasicTessellation::reset();
free(m_data.m_pcLabel);
m_data.m_pcLabel = NULL;
free(m_data.m_puiCodes);
m_data.m_puiCodes = NULL;
A3DUns32 i;
for(i = 0; i < m_data.m_uiTextsSize; ++i)
free(m_data.m_ppcTexts[i]);
free(m_data.m_ppcTexts);
m_data.m_ppcTexts = NULL;
m_data.m_uiCodesSize = m_uiAllocatedCodes = 0;
m_data.m_uiTextsSize = m_uiAllocatedTexts = 0;
}
//######################################################################################################################
void HXWMarkupTessellation::add_code(A3DUns32 uiCode)
{
if(m_uiAllocatedCodes == 0)
{
m_data.m_puiCodes = (A3DUns32*) malloc(ALLOCATION_STEP * sizeof(A3DUns32));
m_uiAllocatedCodes = ALLOCATION_STEP;
}
else if(!(m_data.m_uiCodesSize + 1 < m_uiAllocatedCodes))
{
m_uiAllocatedCodes = m_data.m_uiCodesSize + ALLOCATION_STEP;
A3DUns32* temp = (A3DUns32*) malloc((size_t) m_uiAllocatedCodes * sizeof(A3DUns32));
memcpy(temp, m_data.m_puiCodes, (size_t) m_data.m_uiCodesSize * sizeof(A3DUns32));
if(m_data.m_puiCodes != NULL)
{
free(m_data.m_puiCodes);
m_data.m_puiCodes = NULL;
}
m_data.m_puiCodes = temp;
}
m_data.m_puiCodes[m_data.m_uiCodesSize++] = uiCode;
}
//######################################################################################################################
int HXWMarkupTessellation::set_color(A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue)
{
// add color in session color table
A3DUns32 uiIndexColor;
A3DGraphRgbColorData sData;
A3D_INITIALIZE_DATA(A3DGraphRgbColorData, sData);
sData.m_dRed = dRed;
sData.m_dGreen = dGreen;
sData.m_dBlue = dBlue;
ERR_RET(A3DGlobalInsertGraphRgbColor(&sData,&uiIndexColor));
// add in tessellation
return set_color(uiIndexColor);
}
//######################################################################################################################
int HXWMarkupTessellation::set_color(A3DUns32 uiIndexColor)
{
if(uiIndexColor == A3D_DEFAULT_COLOR_INDEX)
return 0;
// add in tessellation
// 1 = number of additionnal codes, here just one for the index color
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupColorMask, 1));
add_code(0);
add_code(uiIndexColor);
return A3D_SUCCESS;
}
//######################################################################################################################
int HXWMarkupTessellation::set_textfont(const A3DUTF8Char* pcFamilyName, A3DUns32 uiSize, A3DInt8 cAttributes,
A3DECharSet eCharset)
{
// add font in session font tables
A3DFontData sFontData;
A3D_INITIALIZE_DATA(A3DFontData, sFontData);
sFontData.m_cAttributes = cAttributes; // kA3DFontItalic | kA3DFontUnderlined;
sFontData.m_eCharset = eCharset;
unsigned int uiLength = (A3DUns32) (pcFamilyName ? strlen(pcFamilyName) : 0);
if(!uiLength)
return A3D_ERROR;
A3DUTF8Char* newText = (A3DUTF8Char*) malloc(((size_t) (uiLength + 1)) * sizeof(A3DUTF8Char));
memcpy(newText, pcFamilyName, ((size_t) (uiLength + 1)) * sizeof(A3DUTF8Char));
sFontData.m_pcFamilyName = newText;
sFontData.m_uiSize = uiSize;
A3DFontKeyData sFontKeyData;
A3D_INITIALIZE_DATA(A3DFontKeyData, sFontKeyData);
ERR_RET(A3DGlobalFontKeyCreate(&sFontData, &sFontKeyData));
free(newText);
m_sFontKeyData.m_cAttributes = sFontKeyData.m_cAttributes;
m_sFontKeyData.m_iFontFamilyIndex = sFontKeyData.m_iFontFamilyIndex;
m_sFontKeyData.m_iFontSizeIndex = sFontKeyData.m_iFontSizeIndex;
m_sFontKeyData.m_iFontStyleIndex = sFontKeyData.m_iFontStyleIndex;
m_sFontKeyData.m_usStructSize = sFontKeyData.m_usStructSize;
// the font attributes are compressed
A3DUns32 uiAttrib =
(sFontKeyData.m_cAttributes) + (sFontKeyData.m_iFontSizeIndex << 12) + (sFontKeyData.m_iFontStyleIndex << 24);
// add in tessellation
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupFontMask, 2));
add_code(0);
add_code(sFontKeyData.m_iFontFamilyIndex);
add_code(uiAttrib);
return A3D_SUCCESS;
}
//######################################################################################################################
void HXWMarkupTessellation::setlabel(A3DUTF8Char* pcLabel)
{
free(m_data.m_pcLabel);
unsigned int uiSize = (A3DUns32) (pcLabel ? strlen(pcLabel) : 0);
m_data.m_pcLabel = (A3DUTF8Char*) malloc(((size_t) (uiSize + 1)) * sizeof(A3DUTF8Char));
memcpy(m_data.m_pcLabel, pcLabel, (size_t) (uiSize + 1) * sizeof(A3DUTF8Char));
return;
}
//######################################################################################################################
void HXWMarkupTessellation::add_text(const A3DUTF8Char* pcText, A3DDouble dTextWidth, A3DDouble dTextHeight)
{
unsigned int uiSize = (A3DUns32) (pcText ? strlen(pcText) : 0);
if (!uiSize)
return;
if (m_data.m_uiTextsSize == 0)
{
m_data.m_ppcTexts = (A3DUTF8Char**) malloc(ALLOCATION_STEP * sizeof(A3DUTF8Char*));
m_uiAllocatedTexts = ALLOCATION_STEP;
}
else if (!(m_data.m_uiTextsSize + 1 < m_uiAllocatedTexts))
{
m_uiAllocatedTexts = m_data.m_uiTextsSize + ALLOCATION_STEP;
m_data.m_ppcTexts =
(A3DUTF8Char**) realloc(m_data.m_ppcTexts, (size_t) m_uiAllocatedTexts * sizeof(A3DUTF8Char*));
}
A3DUTF8Char* newText = (A3DUTF8Char*) malloc(((size_t) (uiSize + 1)) * sizeof(A3DUTF8Char));
memcpy(newText, pcText, ((size_t) (uiSize + 1)) * sizeof(A3DUTF8Char));
m_data.m_ppcTexts[m_data.m_uiTextsSize] = newText;
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupTextMask, 1));
add_code(2); // width of text + height of text
add_code(m_data.m_uiTextsSize); //index in text array
m_data.m_uiTextsSize++;
double dWidth, dHeight;
A3DGlobalFontTextBoxGet(&m_sFontKeyData, (char*)pcText, &dWidth, &dHeight);
double dScaleWidth, dScaleHeight;
// dScaleHeight = dScaleWidth = 1;
dScaleWidth = dTextWidth / dWidth;
dScaleHeight = dTextHeight / dHeight;
m_coordsdata.m_pdCoords[m_coordsdata.m_uiCoordSize - 16] *= dScaleWidth;
m_coordsdata.m_pdCoords[m_coordsdata.m_uiCoordSize - 15] *= dScaleWidth;
m_coordsdata.m_pdCoords[m_coordsdata.m_uiCoordSize - 14] *= dScaleWidth;
m_coordsdata.m_pdCoords[m_coordsdata.m_uiCoordSize - 12] *= dScaleHeight;
m_coordsdata.m_pdCoords[m_coordsdata.m_uiCoordSize - 11] *= dScaleHeight;
m_coordsdata.m_pdCoords[m_coordsdata.m_uiCoordSize - 10] *= dScaleHeight;
add_coord(dWidth);
add_coord(dHeight);
}
//######################################################################################################################
void HXWMarkupTessellation::add_text(const A3DUTF8Char* pcText)
{
unsigned int uiSize = (A3DUns32) (pcText ? strlen(pcText) : 0);
if (!uiSize)
return;
if (m_data.m_uiTextsSize == 0)
{
m_data.m_ppcTexts = (A3DUTF8Char**) malloc(ALLOCATION_STEP * sizeof(A3DUTF8Char*));
m_uiAllocatedTexts = ALLOCATION_STEP;
}
else if (!(m_data.m_uiTextsSize + 1 < m_uiAllocatedTexts))
{
m_uiAllocatedTexts = m_data.m_uiTextsSize + ALLOCATION_STEP;
m_data.m_ppcTexts =
(A3DUTF8Char**) realloc(m_data.m_ppcTexts, (size_t) m_uiAllocatedTexts * sizeof(A3DUTF8Char*));
}
A3DUTF8Char* newText = (A3DUTF8Char*) malloc(((size_t) (uiSize + 1)) * sizeof(A3DUTF8Char));
memcpy(newText, pcText, ((size_t) (uiSize + 1)) * sizeof(A3DUTF8Char));
m_data.m_ppcTexts[m_data.m_uiTextsSize] = newText;
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupTextMask, 1));
add_code(2); // width of text + height of text
add_code(m_data.m_uiTextsSize); //index in text array
m_data.m_uiTextsSize++;
double dWidth, dHeight;
A3DGlobalFontTextBoxGet(&m_sFontKeyData, (char*)pcText, &dWidth, &dHeight);
add_coord(dWidth);
add_coord(dHeight);
}
//######################################################################################################################
void HXWMarkupTessellation::free_extra_codes()
{
if(m_data.m_uiCodesSize == m_uiAllocatedCodes)
return;
A3DUns32* pnew = NULL;
if(m_data.m_uiCodesSize != 0)
{
pnew = (A3DUns32*) malloc((size_t) m_data.m_uiCodesSize * sizeof(A3DUns32));
memcpy(pnew, m_data.m_puiCodes, (size_t) m_data.m_uiCodesSize * sizeof(A3DUns32));
}
if(m_data.m_puiCodes != NULL)
{
free(m_data.m_puiCodes);
m_data.m_puiCodes = NULL;
}
m_data.m_puiCodes = pnew;
m_uiAllocatedCodes = m_data.m_uiCodesSize;
}
//######################################################################################################################
void HXWMarkupTessellation::add_polyline(A3DDouble* ppoints, A3DUns32 uPtSize)
{
add_code(0); // start of coords in tessellation array
add_code(uPtSize*3); // number of doubles to take into account
add_coords(ppoints, uPtSize*3);
}
//######################################################################################################################
void HXWMarkupTessellation::add_polygon(A3DDouble* ppoints, A3DUns32 uPtSize)
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupPolygonMask, 0));
add_code(uPtSize * 3); // number of doubles to take into account
add_coords(ppoints, uPtSize * 3);
}
//######################################################################################################################
void HXWMarkupTessellation::add_triangle(A3DDouble* pptriangles)
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupTrianglesMask, 0));
add_code(9);
add_coords(pptriangles, 9);
}
//######################################################################################################################
void HXWMarkupTessellation::add_triangles(A3DDouble* pptriangles, A3DUns32 uTriangleSize)
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupTrianglesMask, 0));
add_code(uTriangleSize * 9);
add_coords(pptriangles, uTriangleSize * 9);
}
//######################################################################################################################
void HXWMarkupTessellation::add_polygons(A3DDouble* ppolygons, A3DUns32 uPolygonSize)
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupPolygonMask, 0));
add_code(uPolygonSize * 3);
add_coords(ppolygons, uPolygonSize * 3);
}
//######################################################################################################################
void HXWMarkupTessellation::add_ellipse(A3DDouble dWidth, A3DDouble dHeight)
{
int numPoints = 150;
// Background
A3DDouble* pdMarkupEllipseData = (A3DDouble*) malloc(3* numPoints * sizeof(A3DDouble));
for (int p = 0; p < numPoints; ++p)
{
pdMarkupEllipseData[3 * p] = dWidth / 2 * std::cos(p * 2 * 3.14159265 / numPoints);
pdMarkupEllipseData[3 * p + 1] = dHeight / 2 * std::sin(p * 2 * 3.14159265 / numPoints);
pdMarkupEllipseData[3 * p + 2] = 0;
}
add_polygons(pdMarkupEllipseData, numPoints);
//set_color(0, 0, 1);
//dd_polyline(pdMarkupEllipseData, numPoints);
free(pdMarkupEllipseData);
}
//######################################################################################################################
void HXWMarkupTessellation::add_ellipseFrame(A3DDouble dWidth, A3DDouble dHeight)
{
int numPoints = 150;
// Background
A3DDouble* pdMarkupEllipseData = (A3DDouble*) malloc(3 * numPoints * sizeof(A3DDouble));
for (int p = 0; p < numPoints; ++p)
{
pdMarkupEllipseData[3 * p] = dWidth / 2 * std::cos(p * 2 * 3.14159265 / numPoints);
pdMarkupEllipseData[3 * p + 1] = dHeight / 2 * std::sin(p * 2 * 3.14159265 / numPoints);
pdMarkupEllipseData[3 * p + 2] = 0;
}
add_polyline(pdMarkupEllipseData, numPoints);
free(pdMarkupEllipseData);
}
//######################################################################################################################
void HXWMarkupTessellation::add_rectFrame(A3DDouble dWidth, A3DDouble dHeight)
{
// Frame
A3DDouble* pdMarkupFrameData = (A3DDouble*) malloc(16 * sizeof(A3DDouble));
pdMarkupFrameData[0] = -dWidth / 2; // lower left corner
pdMarkupFrameData[1] = -dHeight / 2;
pdMarkupFrameData[2] = 0;
pdMarkupFrameData[3] = pdMarkupFrameData[0] + dWidth; // lower right corner
pdMarkupFrameData[4] = pdMarkupFrameData[1];
pdMarkupFrameData[5] = pdMarkupFrameData[2];
pdMarkupFrameData[6] = pdMarkupFrameData[0] + dWidth; // upper right corner
pdMarkupFrameData[7] = pdMarkupFrameData[1] + dHeight;
pdMarkupFrameData[8] = pdMarkupFrameData[2];
pdMarkupFrameData[9] = pdMarkupFrameData[0]; // upper left corner
pdMarkupFrameData[10] = pdMarkupFrameData[1] + dHeight;
pdMarkupFrameData[11] = pdMarkupFrameData[2];
pdMarkupFrameData[12] = pdMarkupFrameData[0]; // lower left corner
pdMarkupFrameData[13] = pdMarkupFrameData[1];
pdMarkupFrameData[14] = pdMarkupFrameData[2];
add_polyline(pdMarkupFrameData, 5);
free(pdMarkupFrameData);
}
//######################################################################################################################
void HXWMarkupTessellation::add_rect(A3DDouble dWidth, A3DDouble dHeight)
{
A3DDouble* pdMarkupBackGroundData = (A3DDouble*) malloc(12 * sizeof(A3DDouble));
pdMarkupBackGroundData[0] = -dWidth / 2; // lower left corner
pdMarkupBackGroundData[1] = - dHeight / 2;
pdMarkupBackGroundData[2] = 0;
pdMarkupBackGroundData[3] = pdMarkupBackGroundData[0] + dWidth; // lower right corner
pdMarkupBackGroundData[4] = pdMarkupBackGroundData[1];
pdMarkupBackGroundData[5] = pdMarkupBackGroundData[2];
pdMarkupBackGroundData[6] = pdMarkupBackGroundData[0] + dWidth; // upper right corner
pdMarkupBackGroundData[7] = pdMarkupBackGroundData[1] + dHeight;
pdMarkupBackGroundData[8] = pdMarkupBackGroundData[2];
pdMarkupBackGroundData[9] = pdMarkupBackGroundData[0]; // upper left corner
pdMarkupBackGroundData[10] = pdMarkupBackGroundData[1] + dHeight;
pdMarkupBackGroundData[11] = pdMarkupBackGroundData[2];
add_polygons(pdMarkupBackGroundData, 4);
free(pdMarkupBackGroundData);
}
//######################################################################################################################
void HXWMarkupTessellation::begin_matrix(A3DDouble* matrix)
{
if(matrix)
{
add_code(kA3DMarkupIsMatrix);
add_code(16); // start of coords in tessellation array
add_coords(matrix, 16);
}
}
//######################################################################################################################
void HXWMarkupTessellation::begin_matrix(const A3DVector3dData& position_3d, const A3DVector3dData& plane_normal,
const A3DVector3dData& x_direction)
{
A3DVector3dData y_direction;
y_direction.m_dX = plane_normal.m_dY * x_direction.m_dZ - plane_normal.m_dZ * x_direction.m_dY;
y_direction.m_dY = -(plane_normal.m_dX * x_direction.m_dZ - plane_normal.m_dZ * x_direction.m_dX);
y_direction.m_dZ = plane_normal.m_dX * x_direction.m_dY - plane_normal.m_dY * x_direction.m_dX;
double dScaleX = 1;
double dScaleY = 1;
A3DDouble *matrix = (A3DDouble*) malloc(16 * sizeof(A3DDouble));
matrix[0] = x_direction.m_dX * dScaleX;
matrix[1] = x_direction.m_dY * dScaleX;
matrix[2] = x_direction.m_dZ * dScaleX;
matrix[3] = 0.0;
matrix[4] = y_direction.m_dX * dScaleY;
matrix[5] = y_direction.m_dY * dScaleY;
matrix[6] = y_direction.m_dZ * dScaleY;
matrix[7] = 0.0;
matrix[8] = plane_normal.m_dX * 1;
matrix[9] = plane_normal.m_dY* 1;
matrix[10] = plane_normal.m_dZ* 1;
matrix[11] = 0.0;
matrix[12] = position_3d.m_dX;
matrix[13] = position_3d.m_dY;
matrix[14] = position_3d.m_dZ;
matrix[15] = 1.0;
add_code(kA3DMarkupIsMatrix);
add_code(16); //start of coords in tessellation array
add_coords(matrix, 16);
free(matrix);
}
//######################################################################################################################
void HXWMarkupTessellation::end_matrix()
{
/* end of matrix mode */
add_code(kA3DMarkupIsMatrix);
add_code(0);
}
//######################################################################################################################
void HXWMarkupTessellation::GetMarkupTess(A3DTessMarkup*& pTessMarkup)
{
pTessMarkup = NULL;
A3DTessMarkupData sTessData;
A3D_INITIALIZE_DATA(A3DTessMarkupData, sTessData);
free_extra_coords();
free_extra_codes();
A3DTessMarkupCreate(&m_data,&pTessMarkup);
A3DTessBaseData sTessBaseData;
A3D_INITIALIZE_DATA(A3DTessBaseData, sTessBaseData);
SetCoords(pTessMarkup);
}
/*
Not managed by Acrobat Reader for now - Tech Soft 3D needs to work with Adobe on this issue.
//######################################################################################################################
void HXWMarkupTessellation::set_line_width(double dWidth)
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupLineWidthMask, 0));
add_code(1);
add_coords(&dWidth, 1);
}
//######################################################################################################################
void HXWMarkupTessellation::end_line_width()
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupLineWidthMask, 0));
add_code(0);
}
*/
//######################################################################################################################*/
void HXWMarkupTessellation::BeginFaceView(A3DDouble* pOrigin)
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupFaceViewMask, 0));
add_code(3);
add_coords(pOrigin, 3);
m_uiStartSizeWireFV = m_data.m_uiCodesSize - 2;
m_uiStartCoordsFV = m_coordsdata.m_uiCoordSize - 3;
}
//######################################################################################################################*/
void HXWMarkupTessellation::BeginFaceViewAlwaysOnTop(A3DDouble* pOrigin)
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupFaceViewMask, 0));
m_data.m_cBehaviour |= kA3DMarkupIsOnTop;
add_code(3);
add_coords(pOrigin, 3);
m_uiStartSizeWireFV = m_data.m_uiCodesSize - 2;
m_uiStartCoordsFV = m_coordsdata.m_uiCoordSize - 3;
}
//######################################################################################################################*/
void HXWMarkupTessellation::EndFaceView()
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupFaceViewMask, 0));
add_code(0); // start of coords in tessellation array
// definition de la taille du mode
m_data.m_puiCodes[m_uiStartSizeWireFV] += m_data.m_uiCodesSize - m_uiStartSizeWireFV - 2;
m_data.m_puiCodes[m_uiStartSizeWireFV+1] = m_coordsdata.m_uiCoordSize - m_uiStartCoordsFV;
}
//######################################################################################################################*/
void HXWMarkupTessellation::BeginFrameDraw(A3DDouble* pOrigin)
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupFrameDrawMask, 15));
add_code(3);
add_coords(pOrigin, 3);
m_uiStartSizeWireFS = m_data.m_uiCodesSize - 2;
m_uiStartCoordsFS = m_coordsdata.m_uiCoordSize - 3;
}
//######################################################################################################################*/
void HXWMarkupTessellation::EndFrameDraw()
{
add_code(A3D_ENCODE_EXTRA_DATA(kA3DMarkupFrameDrawMask, 0));
add_code(0);
m_data.m_puiCodes[m_uiStartSizeWireFS] += m_data.m_uiCodesSize - m_uiStartSizeWireFS - 2;
m_data.m_puiCodes[m_uiStartSizeWireFS+1] = m_coordsdata.m_uiCoordSize - m_uiStartCoordsFS;
}

View File

@@ -0,0 +1,161 @@
/***********************************************************************************************************************
*
* 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 wrapper/HXWMarkupTessellation.h
Header file for the wrapper Tessellation module.
***********************************************************************************************************************/
#include "HXWBasicTessellation.h"
/*!
\defgroup wrapper_markuptessellation_module Markup tessellation Module
\ingroup wrapper_tessellation_module
Entity type is \ref HXWMarkupTessellation.
*/
/*! \class HXWMarkupTessellation HXWMarkupTessellation.h "HXWMarkupTessellation.h"
* \brief This is a markup tessellation builder.
* \ingroup wrapper_markuptessellation_module
*/
class HXWMarkupTessellation : public HXWBasicTessellation
{
private:
A3DFontKeyData m_sFontKeyData;
A3DTessMarkupData m_data; /*!< markup tessellation data */
A3DUns32 m_uiAllocatedTexts; /*!< size of allocated texts */
A3DUns32 m_uiAllocatedCodes; /*!< size of allocated codes */
A3DUns32 m_uiStartSizeWireFD;
A3DUns32 m_uiStartCoordsFD;
A3DUns32 m_uiStartSizeWireFV;
A3DUns32 m_uiStartCoordsFV;
A3DUns32 m_uiStartSizeWireFS;
A3DUns32 m_uiStartCoordsFS;
public:
HXWMarkupTessellation();
virtual ~HXWMarkupTessellation();
private:
void free_extra_codes(); /*!< to manage extra allocation */
void add_code(A3DUns32 uiCode); /*!< add code in tessellation */
void reset(); /*!< reset tessellation data */
public:
/*! set markup label
\param pcLabel label. */
inline void setlabel(A3DUTF8Char* pcLabel);
/*! set RGB color
\param dRed [0..1] red value.
\param dGreen [0..1] green value.
\param dBlue [0..1] blue value. */
int set_color(A3DDouble dRed, A3DDouble dGreen, A3DDouble dBlue);
/*! set color
\param uiIndexColor color index in global data */
int set_color(A3DUns32 uiIndexColor);
/*! set font information
\param pcFamilyName Font family name.
\param uiSize Font size. Must be set to 10.
\param cAttributes Font attributes. See \ref a3d_fontattribdef.
\param m_eCharset Font character set. */
int set_textfont(const A3DUTF8Char* pcFamilyName, A3DUns32 uiSize = 10, A3DInt8 cAttributes = 0,
A3DECharSet m_eCharset = kA3DCharsetRoman);
/*! set font information using current preferences */
//int add_current_textfont();
/*! set matrix
\param matrix array of 16 doubles */
void begin_matrix(A3DDouble* matrix);
/*! set matrix using 3 vector
\param position_3d is the orgin
\param plane_normal is the plane normal. Must be a unit vector
\param x_direction is the x_direction; Must be a unit vector
*/
void begin_matrix(const A3DVector3dData& position_3d, const A3DVector3dData& plane_normal,
const A3DVector3dData& x_direction);
void end_matrix();
/*! define a polyline in tessellation
\param ppoints array of 3xN doubles to define points of polyline.
\param uPtSize number of points (N). */
void add_polyline(A3DDouble* ppoints, A3DUns32 uPtSize);
void add_polygon(A3DDouble* ppoints, A3DUns32 uPtSize);
/*! define add triangle tessellation
\param pptriangles array of 3x3xN doubles to define triangle points. */
void add_triangle(A3DDouble* pptriangles);
/*! define add triangle tessellation
\param pptriangles array of 3x3xN doubles to define triangle points.
\param uTriangleSize number of triangles (N). */
void add_triangles(A3DDouble* pptriangles, A3DUns32 uTriangleSize);
/*! define add polygon tessellation
\param ppolygons array of 3xN doubles to define polygon points.
\param uPolygonSize number of points (N). */
void add_polygons(A3DDouble* ppolygons, A3DUns32 uPolygonSize);
/*! define add ellipse tesselation
\param width on current X axe
\param height on current Y axe*/
void add_ellipse(A3DDouble dWidth, A3DDouble dHeight);
void add_ellipseFrame(A3DDouble dWidth, A3DDouble dHeight);
/*! define add rect tesselation
\param width on current X axe
\param height on current Y axe*/
void add_rect(A3DDouble dWidth, A3DDouble dHeight);
void add_rectFrame(A3DDouble dWidth, A3DDouble dHeight);
/*! define text in tessellation. Use add matrix to position the text
\param pcText text to add.
\param dWidth text width.
\param dHeight text height. */
void add_text(const A3DUTF8Char* pcText, A3DDouble dWidth, A3DDouble dHeight);
//, A3DDouble dWidth = 100.0, A3DDouble dHeight = 10.0);
/*! define text in tessellation. Use add matrix to position the text.
The width and height are automatically calculated from the string specified.
\param pcText text to add.
\param dHeight text height. */
void add_text(const A3DUTF8Char* pcText);
//void set_line_width(double dWidth);
//void end_line_width();
/*! define Start the Face View Mode (parralele / Billboard mode). Once Activated, The global coordinate system origin change becoming the Face Mode Origin.
\param pOrigin 3D point*/
void BeginFaceView(A3DDouble* pOrigin);
void BeginFaceViewAlwaysOnTop(A3DDouble* pOrigin);
void EndFaceView();
/*! define Start the non Zoomable Mode
\param pOrigin 3D point*/
void BeginFrameDraw(A3DDouble* pOrigin);
void EndFrameDraw();
void GetMarkupTess(A3DTessMarkup*& pTessMarkup);
virtual A3DEntity* GetEntity();
};