예제 #1
0
bool RendCurve::render(unsigned long time) {
	if(!curve) return false;
	
	set_matrix(XFORM_WORLD, get_prs(time).get_xform_matrix());
	mat.set_glmaterial();

	if(mat.tex[TEXTYPE_DIFFUSE]) {
		set_texture(0, mat.tex[TEXTYPE_DIFFUSE]);
		enable_texture_unit(0);
		set_texture_coord_index(0, 0);
		set_texture_unit_color(0, TOP_MODULATE, TARG_TEXTURE, TARG_PREV);
		set_texture_unit_alpha(0, TOP_MODULATE, TARG_TEXTURE, TARG_PREV);
	}

	set_alpha_blending(true);
	set_zwrite(false);
	set_blend_func(src_blend, dst_blend);

	int line_count = curve->get_segment_count() * detail;
	scalar_t dx = 1.0 / (scalar_t)line_count;
	scalar_t t = dx;
	Vector3 prev_pos = (*curve)(0.0);
	for(int i=1; i<line_count; i++) {
		Vector3 pos = (*curve)(t);
		draw_line(Vertex(prev_pos, 0.0), Vertex(pos, 1.0), width, width);
		prev_pos = pos;
		t += dx;
	}
	
	set_alpha_blending(false);
	set_zwrite(true);
	disable_texture_unit(0);

	return true;
}
예제 #2
0
파일: director.cpp 프로젝트: yujiang/mos
void director::create_director()
{
	glEnable(GL_TEXTURE_2D);
	set_alpha_blending(true);
	set_projection();

	//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}