Files
Hoops_Exchange/exchange/exchangesource/DrawingViewer/callback_opengl.h
2025-12-15 22:06:49 +08:00

191 lines
11 KiB
C

/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
* scope and manner of such use.
*
***********************************************************************************************************************/
/**
\file callback_opengl.h
This file demonstrates how to programmatically visualize a PRC file from a basic OpenGL program using HOOPS Exchange.
***********************************************************************************************************************/
#ifndef _CALLBACK_OPENGL_H_
#define _CALLBACK_OPENGL_H_
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
//#define USE_A3D_CALLBACKS
#ifdef USE_A3D_CALLBACKS
#define A3DORNOTDrawGetBoundingBox A3DDrawGetBoundingBox
#define A3DORNOTDraw A3DDraw
#define A3DORNOTDrawInitCallbacks A3DDrawInitCallbacks
#else
#define A3DORNOTDrawGetBoundingBox DrawGetBoundingBox
#define A3DORNOTDraw Draw
#define A3DORNOTDrawInitCallbacks DrawInitCallbacks
#endif
//######################################################################################################################
A3DStatus OpenGL_SetAndInitCallBack(A3DDrawCallbacksData &sDrawCallbacksData);
//######################################################################################################################
void OpenGL_PushMatrix();
//######################################################################################################################
void OpenGL_PopMatrix();
//######################################################################################################################
void OpenGL_MultMatrix(const A3DDouble adMatrix[16]);
//######################################################################################################################
void OpenGL_GetMatrix(A3DDouble adMatrix[16]);
//######################################################################################################################
void OpenGL_SetIgnoreViewMatrix(A3DDouble adIgnoreViewMatrix[16]);
//######################################################################################################################
void OpenGL_Begin(A3DEDrawBeginEndType eType, const A3DUTF8Char* pcName, A3DUns32 uiTrianglesCount);
//######################################################################################################################
void OpenGL_End(A3DEDrawBeginEndType eType);
//######################################################################################################################
void OpenGL_Triangle(const A3DVector3dData* pasNormals, const A3DVector3dData* pasPoints, A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleFan(const A3DVector3dData* pasNormals, const A3DVector3dData* pasPoints, A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleStripe(const A3DVector3dData* pasNormals, const A3DVector3dData* pasPoints, A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleOneNormal(const A3DVector3dData* pasNormals, const A3DVector3dData* pasPoints,
A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleFanOneNormal(const A3DVector3dData* psNormal, const A3DVector3dData* pasPoints,
A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleStripeOneNormal(const A3DVector3dData* psNormal, const A3DVector3dData* pasPoints,
A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleTextured(const A3DVector3dData* pasNormals, const A3DVector3dData* pasPoints, A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleFanTextured(const A3DVector3dData* pasNormals, const A3DVector3dData* pasPoints,
A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleStripeTextured(const A3DVector3dData* pasNormals, const A3DVector3dData* pasPoints,
A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleOneNormalTextured(const A3DVector3dData* pasNormals, const A3DVector3dData* pasPoints,
A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleFanOneNormalTextured(const A3DVector3dData* psNormal, const A3DVector3dData* pasPoints,
A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_TriangleStripeOneNormalTextured(const A3DVector3dData* psNormal, const A3DVector3dData* pasPoints,
A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_Material(A3DEDrawMaterialType eType, const A3DDouble* pdValues, A3DUns32 uiSize);
//######################################################################################################################
void OpenGL_BeginMaterial(void);
//######################################################################################################################
void OpenGL_EndMaterial(void);
//######################################################################################################################
void OpenGL_GetDrawContext(A3DDouble adProjection[16], A3DDouble adModelView[16], A3DInt32 aiViewport[4]);
//######################################################################################################################
void OpenGL_MarkupTriangle(const A3DDouble* pdPoints, A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_UnProject(const A3DVector3dData* psPoint, A3DVector3dData* psResult);
//######################################################################################################################
void OpenGL_BeginFrameDraw(const A3DVector3dData* psPoint3d, A3DBool bIsZoomable, A3DDouble dFixedSize);
//######################################################################################################################
void OpenGL_EndFrameDraw(void);
//######################################################################################################################
void OpenGL_BeginFixedSize(const A3DVector3dData* psPoint3d);
//######################################################################################################################
void OpenGL_EndFixedSize(void);
//######################################################################################################################
void OpenGL_Cylinder(A3DDouble dBaseRadius, A3DDouble dTopRadius, A3DDouble dHeight);
//######################################################################################################################
void OpenGL_Polygon(const A3DDouble* pdPoints, A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_BeginLineWidth(A3DDouble dWidth);
//######################################################################################################################
void OpenGL_EndLineWidth(void);
//######################################################################################################################
void OpenGL_Point(const A3DDouble* pdPoints, A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_Font(const A3DFontKeyData* psFontKeyData);
//######################################################################################################################
void OpenGL_BeginLineStipple(const A3DGraphStyleData* psGraphStyleData);
//######################################################################################################################
void OpenGL_EndLineStipple(void);
//######################################################################################################################
void OpenGL_Symbol(const A3DGraphVPicturePatternData* psPatternData, const A3DVector3dData* psPosition);
//######################################################################################################################
void OpenGL_PolyLine(const A3DDouble* pdPoints, A3DUns32 uiPointSize);
//######################################################################################################################
void OpenGL_Text(const A3DUTF8Char* pcBuffer, A3DDouble dWidth, A3DDouble dHeight);
//######################################################################################################################
void OpenGL_Pattern(A3DUns32 uiLoopsSize, A3DUns32 uiPatternId, A3DUns32 uiFilledMode, A3DUns32 uiBehavior,
const A3DDouble* pdPoints, const A3DUns32* puiLoopsPointSize);
//######################################################################################################################
void OpenGL_Picture(const A3DGraphPictureData* psPictureData);
//######################################################################################################################
void OpenGL_Color(const A3DDouble* pdValues, A3DUns32 uiSize);
//######################################################################################################################
int& DisplayTriangles();
//######################################################################################################################
int& DisplayTriangleNormals();
//######################################################################################################################
double& DisplayTriangleNormalLength();
#endif // _CALLBACK_OPENGL_H_