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

📄 subdiv_mesh.h

📁 是3D游戏一书中所讲的游戏引擎fly3D 包括fly3D引擎的源码及应用此引擎开发出来的游戏实例 有fly3D引擎的教程,易于step by step跟学
💻 H
字号:
class subdiv_mesh : public bsp_object
{
public:
	subdiv_mesh() 
	{
		type=TYPE_SUBDIV_MESH; 
		divmesh=0; nedges=0; edges=0; edgefaces=0;
		dynlight.null();
	};
	~subdiv_mesh() { reset(); };

	// dynamic vertex light info
	light_vertex dynlights;	
	// dynamic constant light info
	vector dynlight;

	int nsubdiv;	// num subdivisions
	int mode;		// mode: 0-standard 1-modified
	mesh* basemesh;	// base mesh
	mesh* divmesh;	// basemesh subdivided nsubdiv times

	int nedges;		// number of edges
	int *edges;		// edges array (2*nedges)
	int *edgefaces;	// faces array (2*nedges)
	
	void reset();	// reset allocated data
	void subdiv();	// subdiv mesh nsubdiv times

	// finds edge with vertices v1,v2
	int get_edge(int v1,int v2);
	// get valence for vertex v1
	int get_valence(int v1);

	// add all mesh edges to the edges array
	void build_edge_list(mesh *m1);
	// add a single edge to the edges array
	void add_edge(int v1,int v2,int f);	
	// add one vertex at m2 for each edge in m1
	void add_vertices(mesh *m1,mesh *m2);
	// add 4 faces in m2 for each face from m1
	void add_faces(mesh *m1,mesh *m2);

	void init();
	void draw();
	int step(int dt) { return 0; };
	mesh *get_mesh() { return divmesh; };
	int get_custom_param_desc(int i,param_desc *pd);
	bsp_object *clone();
	int message(vector& p,float rad,int msg,int param,void *data);
};

class subdiv_mesh_desc : public class_desc
{
public:
	void *create() { return new subdiv_mesh; };
	char *get_name() { return "subdiv_mesh"; };
	int get_type() { return TYPE_SUBDIV_MESH; };
};

⌨️ 快捷键说明

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