This commit is contained in:
ninja
2025-12-15 23:22:33 +08:00
parent 019570564b
commit 8782765fbc
809 changed files with 118753 additions and 18289 deletions

View File

@@ -1,6 +1,6 @@
/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
* Copyright (c) 2010 - 2025 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
@@ -23,6 +23,7 @@ Then we re-traverse the model to draw the different items.
#define INITIALIZE_A3D_API
#include <A3DSDKIncludes.h>
#include <hoops_license.h>
#include "../common.hpp"
@@ -54,10 +55,10 @@ static A3DStatus DrawModel(const A3DAsmModelFile* pModelFile);
//######################################################################################################################
A3DStatus DrawGetBoundingBox(const A3DAsmModelFile* pModelFile, A3DBoundingBoxData* psBoundingBox,
A3DUns32 uiDrawFlags);
const A3DBool bIncludeMarkups = false);
//######################################################################################################################
static A3DStatus Draw(const A3DAsmModelFile* pModelFile, A3DUns32 uiDrawFlags);
static A3DStatus Draw(const A3DAsmModelFile* pModelFile, const A3DBool bIncludeMarkups = false);
//######################################################################################################################
A3DAsmModelFile* ComputeSection(A3DAsmModelFile* pModelFile, A3DPlanarSectionData sSectionParametersData);
@@ -237,7 +238,6 @@ private:
};
//######################################################################################################################
static A3DDrawCallbacksData stsDrawCallbacksData;
static A3DSDKHOOPSExchangeLoader* stpHOOPSExchangeLoader = nullptr;
static A3DAsmModelFile* pSectionnedModelFile = nullptr;
@@ -570,9 +570,12 @@ void Display(void)
glScalef(stdZoom, stdZoom, stdZoom); // scale the matrix
#ifdef DIRECT_RENDERING
Draw(stpHOOPSExchangeLoader->m_psModelFile, kA3DDraw3D);
if(GetstbDrawMarkups())
Draw(stpHOOPSExchangeLoader->m_psModelFile, kA3DDrawMarkups);
Draw(stpHOOPSExchangeLoader->m_psModelFile);
if (GetstbDrawMarkups())
{
constexpr bool bIncludeMarkups = true;
Draw(stpHOOPSExchangeLoader->m_psModelFile, bIncludeMarkups);
}
#else
glCallList(stuiModelFileDisplayList);
if(GetstbDrawMarkups())
@@ -731,10 +734,10 @@ static void stRebuildGenList()
glNewList(stuiModelFileDisplayList, GL_COMPILE);
if(!stbDisplaySection)
Draw(stpHOOPSExchangeLoader->m_psModelFile, kA3DDraw3D);
Draw(stpHOOPSExchangeLoader->m_psModelFile);
else
Draw(pSectionnedModelFile, kA3DDraw3D);
Draw(pSectionnedModelFile);
glEndList();
@@ -1062,7 +1065,7 @@ void SpecialKey(int key, int /* x */, int /* y */)
}
//######################################################################################################################
A3DStatus DrawGetBoundingBox(const A3DAsmModelFile* pModelFile, A3DBoundingBoxData* psBoundingBox, A3DUns32 uiDrawFlags)
A3DStatus DrawGetBoundingBox(const A3DAsmModelFile* pModelFile, A3DBoundingBoxData* psBoundingBox, const A3DBool bIncludeMarkups)
{
A3DStatus iRet = A3D_SUCCESS;
@@ -1074,8 +1077,7 @@ A3DStatus DrawGetBoundingBox(const A3DAsmModelFile* pModelFile, A3DBoundingBoxDa
stLoadIdentity();
stExtentInit(psBoundingBox);
SetstbDraw3D((uiDrawFlags & kA3DDraw3D) != 0);
SetstbDrawMarkups((uiDrawFlags & kA3DDrawMarkups) != 0);
SetstbDrawMarkups(bIncludeMarkups);
SetstpsBoundingBox(psBoundingBox);
SetstbUseCallbacks(false);
CHECK_RET(DrawModel(pModelFile));
@@ -1189,7 +1191,7 @@ static A3DStatus DrawModel(const A3DAsmModelFile* pModelFile)
}
//######################################################################################################################
A3DStatus Draw(const A3DAsmModelFile* pModelFile, A3DUns32 uiDrawFlags)
A3DStatus Draw(const A3DAsmModelFile* pModelFile, const A3DBool bIncludeMarkups)
{
if(pModelFile == nullptr)
return A3D_INVALID_ENTITY_NULL;
@@ -1199,8 +1201,7 @@ A3DStatus Draw(const A3DAsmModelFile* pModelFile, A3DUns32 uiDrawFlags)
stLoadIdentity();
SetstbDraw3D((uiDrawFlags & kA3DDraw3D) != 0);
SetstbDrawMarkups((uiDrawFlags & kA3DDrawMarkups) != 0);
SetstbDrawMarkups(bIncludeMarkups);
SetstbUseCallbacks(true);
CHECK_RET(DrawModel(pModelFile));
@@ -1225,7 +1226,7 @@ A3DStatus OpenFile(const A3DUTF8Char* pcCADFileName)
return iRet;
// Traverse the model once to retrieve the bounding box
CHECK_RET(DrawGetBoundingBox(stpHOOPSExchangeLoader->m_psModelFile, &stsInfo3D.sBoundingBox, kA3DDraw3D));
CHECK_RET(DrawGetBoundingBox(stpHOOPSExchangeLoader->m_psModelFile, &stsInfo3D.sBoundingBox));
stsInfo3D.Calculate();
#ifndef DIRECT_RENDERING
@@ -1235,12 +1236,12 @@ A3DStatus OpenFile(const A3DUTF8Char* pcCADFileName)
if(!stbDisplaySection)
{
// Traverse the model a second time to draw the items
CHECK_RET(Draw(stpHOOPSExchangeLoader->m_psModelFile, kA3DDraw3D));
CHECK_RET(Draw(stpHOOPSExchangeLoader->m_psModelFile));
}
else
{
// Draw the section
CHECK_RET(Draw(pSectionnedModelFile, kA3DDraw3D));
CHECK_RET(Draw(pSectionnedModelFile));
}
}
glEndList();
@@ -1249,7 +1250,8 @@ A3DStatus OpenFile(const A3DUTF8Char* pcCADFileName)
Reshape(staiWinSize[0], staiWinSize[1]);
// Traverse the model once to retrieve the bounding box with the markups
CHECK_RET(DrawGetBoundingBox(stpHOOPSExchangeLoader->m_psModelFile, &stsInfoMarkups.sBoundingBox, kA3DDrawMarkups));
constexpr bool bIncludeMarkups = true;
CHECK_RET(DrawGetBoundingBox(stpHOOPSExchangeLoader->m_psModelFile, &stsInfoMarkups.sBoundingBox, bIncludeMarkups));
stsInfoMarkups.Calculate();
#ifndef DIRECT_RENDERING
@@ -1259,7 +1261,7 @@ A3DStatus OpenFile(const A3DUTF8Char* pcCADFileName)
if(!stbDisplaySection)
{
// Traverse the model a second time to draw the items (including the markups)
CHECK_RET(Draw(stpHOOPSExchangeLoader->m_psModelFile, kA3DDrawMarkups));
CHECK_RET(Draw(stpHOOPSExchangeLoader->m_psModelFile, bIncludeMarkups));
}
}
glEndList();
@@ -1342,7 +1344,7 @@ int main(A3DInt32 iArgc, A3DUTF8Char** ppcArgv)
// ### INITIALIZE HOOPS EXCHANGE
//
stpHOOPSExchangeLoader = new A3DSDKHOOPSExchangeLoader(_T(HOOPS_BINARY_DIRECTORY));
stpHOOPSExchangeLoader = new A3DSDKHOOPSExchangeLoader(_T(HOOPS_BINARY_DIRECTORY), HOOPS_LICENSE);
if (stpHOOPSExchangeLoader->m_eSDKStatus != A3D_SUCCESS)
{
A3DStatus eSDKStatus = stpHOOPSExchangeLoader->m_eSDKStatus;