Example #1
0
	bool SealData::draw(const D3DXMATRIX & world_mat, const D3DMATERIAL9 & material) const
	{
		HRESULT hr;
		// バッファをロックをして書き込みを開始する
		DxTop2D * vert_arr = nullptr;
		hr = vertbuff->Lock(0, 0, fw::pointer_cast<void **>(&vert_arr), 0);
		if (FAILED(hr)) return false;
		DxTop2D * converted_vert_arr = nullptr;
		hr = converted_vertbuff->Lock(0, 0, fw::pointer_cast<void **>(&converted_vert_arr), 0);
		if (FAILED(hr)) return false;

		convert_vertex(vert_arr, world_mat, converted_vert_arr);

		// バッファをアンロックして書き込みを終了する
		vertbuff->Unlock();
		converted_vertbuff->Unlock();

		draw(
			device,
			world_mat,
			texture,
			converted_vertbuff,
			indexbuff,
			index_num,
			triangle_num,
			material);

		return true;
	}
Example #2
0
int convert_face (struct surface *srf, struct face *f)
{
	int j, n_e;
	char message[MAXLINE];
	struct vertex *vtx;
	struct arc *a;
	struct edge *ed;
	struct cycle *cyc;
	
	if (f -> problem) return(0);
	/* skip degenerate faces */
	/* if (srf -> van_der_Waals && f -> shape != CONVEX) return(0); */
	cyc = f -> first_cycle;
	n_e = 0;
	for (ed = cyc -> first_edge; ed != NULL; ed = ed -> next) {
		n_e++;
	}
	if (n_e < 3) {
		sprintf (message, "(convert_face): face with %d sides", n_e);
		set_error1 (message);
		sprintf (message, "ofn = %ld, lfn = %ld", f -> ofn, f -> lfn);
		set_error2 (message);
		return (0);
	}
	if (n_e > 3) {
		sprintf (message, "(convert_face): face with %d sides", n_e);
		set_error1 (message);
		sprintf (message, "ofn = %ld, lfn = %ld", f -> ofn, f -> lfn);
		set_error2 (message);
		return (0);
	}
	n_e = 0;
	for (ed = cyc -> first_edge; ed != NULL; ed = ed -> next) {
		a = ed -> arcptr;
		if (n_e > 2) {
			sprintf (message, "(convert_face): face with %d sides", n_e);
			set_error1 (message);
			sprintf (message, "ofn = %ld, lfn = %ld", f -> ofn, f -> lfn);
			set_error2 (message);
			return (0);
		}
		for (j = 0; j < 2; j++) {
			vtx = a -> vtx[j];
			if (vtx != (struct vertex *) NULL) {
				if (!convert_vertex (srf, vtx)) {
					inform("convert_face: failure to convert vertex");
					return (0);
				}
			}
		}
		if (!convert_edge (srf, a)) {
			inform("convert_face: failure to convert edge");
			return(0);
		}
		n_e++;
	}
	if (!convert_triangle (srf, f)) {
		inform("convert_face: failure to convert triangle");
		return(0);
	}
	return(1);
}