⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 riceindices.h

📁 x3d_new.rar
💻 H
字号:
// “米” 字索引模板类
// 
// 根据指定忽略的点给出合理的索引,用在QuadTree中绘制地形块,避免裂缝
// 提前生成所有可能的(从完全扇面到全部忽略)索引组,直接提供给其他类使用,以内存换速度
// 共 2^8 = 256 种可能

// Xiqiang 03/29/2007

/*
	4-3-2
	|\|/|
	5-0-1
	|/|\|
	6-7-8
*/

#pragma once

#include <assert.h>

// 忽略点枚举(可叠加使用)
enum ERiceIgnore
{
    RI_NONE     = 0,		// 完全(不忽略任何点)

    RI_RIGHT    = 1 << 0,	// (1)右
    RI_RT       = 1 << 1,	// (2)右上
    RI_TOP      = 1 << 2,	// (3)上
    RI_LT       = 1 << 3,	// (4)左上
    RI_LEFT     = 1 << 4,	// (5)左
    RI_LB       = 1 << 5,	// (6)左下
    RI_BOTTOM   = 1 << 6,	// (7)下
    RI_RB       = 1 << 7,	// (8)右下
};


// ----------------------------------------------------------------
// *索引模板
struct SRiceIndicesTemplate
{
    int             m_nIndicesNum;	// 索引数目
    unsigned char*  m_pIndices;		// 索引地址
};


// ----------------------------------------------------------------
// *索引模板管理器
// 控制生成、销毁所有模板,提供接口给其他类使用
class CRiceIndicesMng
{
public:
    CRiceIndicesMng(void);
public:
    ~CRiceIndicesMng(void);

public:
	// 得到索引模板(指定忽略点)
    const SRiceIndicesTemplate* GetTemplate(unsigned int uRiceIgnore) const{
		assert(m_bValid); // 还未创建?
        return &m_Templates[uRiceIgnore];
    }

    bool IsValid(void){
        return m_bValid;
    }

public:
    bool Create(void);	// 创建
    void Destroy(void);	// 销毁

private:
	// 创建模板(指定忽略点)
    bool CreateTemplate(unsigned int uRiceIgnore);

private:
    SRiceIndicesTemplate m_Templates[256];	// 模板数组

private:
	bool m_bValid;	// 是否已创建 
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -