📄 mgcbsptree.h
字号:
// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement. The various license agreements may be found at
// the Magic Software web site. This file is subject to the license
//
// RESTRICTED USE SOURCE CODE
// http://www.magic-software.com/License/restricted.pdf
#ifndef MGCBSPTREE_H
#define MGCBSPTREE_H
// Creation of a BSP tree from a list of triangles. The internal nodes of
// the tree are MgcBspNode objects and store the coplanar triangles (if any)
// of the splitting planes.
#include "MgcBspNode.h"
#include "MgcTClassList.h"
class MgcColor;
class MgcVector2;
class MgcVector3;
class MgcBspTree : public MgcBspNode
{
MgcDeclareRTTI;
MgcDeclareStream;
public:
class Triangle
{
public:
Triangle ();
MgcVector3 m_akVertex[3];
MgcVector3* m_apkNormal[3];
MgcColor* m_apkColor[3];
MgcVector2* m_apkTexture[3];
};
typedef MgcTClassList<Triangle*> TriangleList;
// Construction. The input list is consumed by the construction, so the
// application should keep a copy of the list if it needs to be used
// elsewhere.
MgcBspTree (TriangleList& rkList);
protected:
MgcBspTree ();
void CreateTree (TriangleList& rkList);
void SplitTriangle (Triangle* pkTri, TriangleList& rkPositive,
TriangleList& rkNegative, TriangleList& rkCoincident);
void ClipTriangle (int i0, int i1, int i2, Triangle* pkTri,
MgcReal afDistance[3], TriangleList& rkPositive,
TriangleList& rkNegative);
void AddTriangle (TriangleList& rkList, const MgcVector3& rkV0,
const MgcVector3& rkV1, const MgcVector3& rkV2, bool bHasNormals,
const MgcVector3* pkN0, const MgcVector3* pkN1,
const MgcVector3* pkN2, bool bHasColors, const MgcColor* pkC0,
const MgcColor* pkC1, const MgcColor* pkC2, bool bHasTextures,
const MgcVector2* pkT0, const MgcVector2* pkT1,
const MgcVector2* pkT2);
};
MgcSmartPointer(MgcBspTree);
MgcRegisterStream(MgcBspTree);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -