/** * @file XTPOpenGLTriangleRenderList.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPOPENGLTRIANGLERENDERLIST_H__) # define __XTPOPENGLTRIANGLERENDERLIST_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** @cond */ class _XTP_EXT_CLASS CXTPOpenGLTriangleRenderList { public: CXTPOpenGLTriangleRenderList(); ~CXTPOpenGLTriangleRenderList(); BOOL IsEmpty() const; void SetCurrentMatrices(); void SetCurrentColor(float r, float g, float b, float a); void Add(const CXTPPoint3d& a, const CXTPPoint3d& an, const CXTPPoint3d& b, const CXTPPoint3d& bn, const CXTPPoint3d& c, const CXTPPoint3d& cn); void Commit(); void RenderAll(); void Reset(); void SetJitter(const CXTPPoint3d& offset); private: struct State { UINT nRefs; GLfloat mView[16]; void Activate(const CXTPPoint3d& jitter); }; struct Color { UINT nRefs; float r; float g; float b; float a; void Activate(); }; struct Triangle { State* pState; Color* pColor; double dDist; struct Vertices { CXTPPoint3d v, n; } a, b, c; }; static int __cdecl Compare(const void* x, const void* y); void PushRenderState(Triangle& triangle); void PopRenderState(); void RenderTriangle(const CXTPPoint3d& a, const CXTPPoint3d& an, const CXTPPoint3d& b, const CXTPPoint3d& bn, const CXTPPoint3d& c, const CXTPPoint3d& cn); void ClearTriangleList(); CArray m_list; CList m_states; CList m_colors; CList m_RenderStateQueue; CList m_RenderColorQueue; CXTPPoint3d m_jitter; BOOL m_bCommitted; }; AFX_INLINE BOOL CXTPOpenGLTriangleRenderList::IsEmpty() const { return m_list.GetSize() == 0; } AFX_INLINE void CXTPOpenGLTriangleRenderList::SetJitter(const CXTPPoint3d& offset) { m_jitter = offset; } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPOPENGLTRIANGLERENDERLIST_H__) /** @endcond */