Dev:Source/Modeling/Bmesh Integration

提供: wiki
移動先: 案内検索
Note
This page is outdated. See the official doc mirror for more information.


This page documents the progress of the bmesh integration project.

Introduction

Bmesh is a nice new mesh kernel for blender to use. It supports ngons and all kinds of cool things.

Integration

Mesh DNA

Mesh dna has been changed so faces are stored with the following two structs:

typedef struct MPoly {
	unsigned int firstloop, totloop;
	char flag, mat_nr, pad1, pad2;
	float no[3]; int pad3;
} MPoly;

typedef struct MLoop {
	unsigned int edge, v, poly;
	unsigned int flag;
} MLoop;

MPolys are stored in mesh->mpoly, and loops are stored in mesh->mloop.

Note that mloops are stored in the order they appear in mpolys in mesh->mloop.

DerivedMesh API

The DerivedMesh api has been extended to deal with mloops/mpolys

Customdata

Both mloops and mpolys are now supported in the customdata system.

Editmode

BMesh is used as a replacement for editmesh. The main stuff happens in src/editbmesh_interface.c, which has the basic editmode conversion stuff based on two generic functions that convert BME_Meshs to Meshs and Meshs to BME_Meshs.

Drawing

Current CDDM has been patched to deal with the new mesh structure, and (extreamly buggily) can draw the default cube (which is automatically converted to the new mesh dna in do_versions() in readfile.c on startup).

Currently no editmode drawing has been coded, the plan is to use a cache drawing API.

Cache Drawing API

The cache drawing API is an API to draw stuff with vertex arrays. Drawing with vertex arrays isn't really more difficult then without, once you get the hang of them.

More info once actual coding of this begins.