本文整理汇总了C++中draw_lines函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_lines函数的具体用法?C++ draw_lines怎么用?C++ draw_lines使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_lines函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: draw_lines
void rasterizer::draw_triangles()
{
const auto& desc = state_->get_desc();
if (desc.fm == fill_wireframe) {
draw_lines();
} else if (desc.fm == fill_solid) {
if (prim_vert_cnt_ < 3) {
draw_lines();
return;
}
//draw_lines();
assert(prim_vert_cnt_ == 3);
bool have_color = !colors_.empty();
for (size_t index = 0; index < indices_.size(); ) {
const auto& v0 = wvp_[indices_[index]];
const auto& v1 = wvp_[indices_[index + 1]];
const auto& v2 = wvp_[indices_[index + 2]];
const color_rgba8* c0 = &color_rgba8::black;
const color_rgba8* c1 = &color_rgba8::black;
const color_rgba8* c2 = &color_rgba8::black;
if (have_color) {
c0 = &colors_[indices_[index]];
c1 = &colors_[indices_[index + 1]];
c2 = &colors_[indices_[index + 2]];
}
draw_triangle(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, *c0, *c1, *c2);
index += prim_vert_cnt_;
}
}
}
开发者ID:nomadfighter,项目名称:softcore,代码行数:30,代码来源:rasterizer.cpp
示例2: track_draw
void track_draw(void)
{
int head = tracklog_idx;
if (tracklog_size == MAX_TRACK)
draw_lines(&tracklog[head], MAX_TRACK - head, VFDSHADE_DIM);
draw_lines(tracklog, head, VFDSHADE_DIM);
}
开发者ID:empeg,项目名称:gpsapp,代码行数:9,代码来源:track.c
示例3: main
int main() {
screen s;
color c;
/* Setup color and screen */
clear_screen(s);
c.red = 255;
c.green = 150;
c.blue = 100;
/* Setup matrices */
struct matrix *edges;
struct matrix *transform;
edges = new_matrix(4, 1);
/* Finally Testing */
add_edge(edges, 80, 80, 0, 80, 120, 0);
add_edge(edges, 80, 120, 0, 120, 120, 0);
add_edge(edges, 120, 120, 0, 120, 80, 0);
add_edge(edges, 120, 80, 0, 80, 80, 0);
add_edge(edges, 60, 80, 0, 80, 120, 0);
add_edge(edges, 80, 120, 0, 100, 100, 0);
add_edge(edges, 100, 100, 0, 80, 60, 0);
add_edge(edges, 80, 60, 0, 60, 80, 0);
add_edge(edges, 90, 90, 0, 110, 90, 0);
add_edge(edges, 110, 90, 0, 110, 110, 0);
add_edge(edges, 110, 110, 0, 90, 110, 0);
add_edge(edges, 90, 110, 0, 90, 90, 0);
draw_lines(edges, s, c);
int i;
for (i = 0; i < 40; i+=2) {
transform = make_translate(i, i, i);
matrix_mult(transform, edges);
draw_lines(edges, s, c);
}
display(s);
save_extension(s, "matrix.png");
/* Free Matrices */
free_matrix( transform );
free_matrix( edges );
return 0;
}
开发者ID:young-k,项目名称:Notes,代码行数:56,代码来源:main.c
示例4: main
int main()
{
t_infos s;
int color;
t_vect a;
t_vect b;
s.mlx_ptr = mlx_init();
s.win_ptr = mlx_new_window(s.mlx_ptr, 500, 500, "lolilol");
a.x = 0;
a.y = 0;
b.x = 250;
b.y = 250;
while (1)
{
color = rand_val(0, 0x00FFFFFF);
while (a.x != 500)
{
color = rand_val(0, 0x00FFFFFF);
draw_lines(s, a, b, color);
usleep(TIME);
a.x++;
}
while (a.y != 500)
{
color = rand_val(0, 0x00FFFFFF);
draw_lines(s, a, b, color);
a.y++;
usleep(TIME);
}
while (a.x != 0)
{
color = rand_val(0, 0x00FFFFFF);
draw_lines(s, a, b, color);
a.x--;
usleep(TIME);
}
while (a.y != 0)
{
color = rand_val(0, 0x00FFFFFF);
draw_lines(s, a, b, color);
a.y--;
usleep(TIME);
}
}
mlx_loop(s.win_ptr);
}
开发者ID:retrobotic,项目名称:Epitech,代码行数:48,代码来源:main.c
示例5: main
int main( int argc, char** argv ) {
screen s;
struct matrix *edges;
struct matrix *transform;
color c;
c.red = 200;
c.blue = 150;
c.green = 150;
edges = new_matrix(4, 4);
transform = new_matrix(4, 4);
clear_screen( s );
add_sphere( edges, 250, 250, 50, .01 );
add_torus( edges, 200, 200, 25, 50, .01 );
add_box( edges, 250, 250, 0, 100, 100, 100 );
draw_lines( edges, s, c );
/* if ( argc == 2 )
parse_file( argv[1], transform, edges, s );
else
parse_file( "stdin", transform, edges, s );
*/
display(s);
printf("hi\n");
save_ppm( s, "curves.ppm" );
free_matrix( transform );
free_matrix( edges );
}
开发者ID:CodeSammich,项目名称:hw4,代码行数:34,代码来源:main.c
示例6: draw_lines
void draw_lines(std::shared_ptr<image_t> img, const std::vector<vec2f_t>& lines, float color, int thickness, const mat3f_t& image_transform, std::function<bool (uint32_t)> accept_lines) {
std::vector<vec2i_t> discrete_lines(lines.size());
for (uint32_t i = 0; i < lines.size(); ++i) {
discrete_lines[i] = (image_transform * lines[i].homogeneous()).head(2).template cast<int>();
}
draw_lines(img, discrete_lines, color, thickness, accept_lines);
}
开发者ID:paulhilbert,项目名称:october,代码行数:7,代码来源:drawing.cpp
示例7: points
void MGCommandDrawer::draw_points_lines(
const MGColor& pcolor, //color of points(boundary)
const MGColor& lcolor, //color of line.
const std::vector<MGPosition>& ipos
)const{
draw_lines(lcolor,ipos);
draw_points(pcolor,ipos);
}
开发者ID:zephyrer,项目名称:mgcl,代码行数:8,代码来源:CommandDrawer.cpp
示例8: fl_color
void Shape::draw() const
{
Fl_Color oldc = fl_color();
// there is no good portable way of retrieving the current style
fl_color(lcolor.as_int()); // set color
fl_line_style(ls.style(),ls.width()); // set style
draw_lines();
fl_color(oldc); // reset color (to previous)
fl_line_style(0); // reset line style to default
}
开发者ID:jake-leland,项目名称:Logic-tron,代码行数:10,代码来源:Graph.cpp
示例9: draw
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_save (cr);
cairo_set_line_width (cr, FIXED_POINT_MIN*10.0);
draw_lines (cr);
cairo_restore (cr);
cairo_translate (cr, CELL_WIDTH + PAD, 0);
cairo_save (cr);
cairo_set_line_width (cr, FIXED_POINT_MIN);
draw_lines (cr);
cairo_restore (cr);
cairo_translate (cr, CELL_WIDTH + PAD, 0);
cairo_save (cr);
cairo_set_line_width (cr, FIXED_POINT_MIN/10.0);
draw_lines (cr);
cairo_restore (cr);
return CAIRO_TEST_SUCCESS;
}
开发者ID:Distrotech,项目名称:cairo,代码行数:22,代码来源:thin-lines.c
示例10: draw_grid
void
draw_grid(cairo_t *cr, gint width, gint height)
{
if (grid_snap && grid_type != GRID_HIDDEN)
{
cairo_save (cr);
if (grid_type == GRID_LINES)
{
draw_lines(cr, width, height);
}
else
{
draw_crosses(cr, width, height);
}
cairo_restore (cr);
}
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:17,代码来源:imap_grid.c
示例11: drawPicture
void drawPicture(screen s, color c){
struct matrix* picture = new_matrix(3, 5);
int startx = 45;
int starty = 400;
int counter = 1;
int sizec = 0.5;
int locationc = 50;
while(counter != 9){
free_matrix(picture);
picture = new_matrix(3,5);
startx+= locationc;
//starty = starty + 25*(7-counter);
add_edge(picture, startx, starty, 1, startx+50, starty, 1);
add_edge(picture, startx+50, starty, 1, startx+90, starty-40, 1);
add_edge(picture, startx+90, starty-40, 1, startx+90, starty-90, 1);
add_edge(picture, startx+90, starty-90, 1, startx+50, starty-130, 1);
add_edge(picture, startx+50, starty-130, 1, startx, starty-130, 1);
add_edge(picture, startx, starty-130, 1, startx-40, starty-90,1);
add_edge(picture, startx-40, starty-90,1, startx-40,starty-40,1);
add_edge(picture, startx-40, starty-40,1, startx, starty, 1);
scalar_mult(sizec +(counter *0.10), picture);
locationc+= 5;
draw_lines(picture, s,c);
counter++;
}
//print_matrix(picture);
//scalar_mult(1.5, picture);
/*
scalar_mult(0.5, picture);
matrix_mult(transformers, picture);
draw_lines(picture, s, c);
*/
}
开发者ID:stuydw,项目名称:matrix,代码行数:46,代码来源:main.c
示例12: main
int main( int argc, char** argv ) {
screen s;
struct matrix *edges;
struct matrix *transform;
color c;
c.red = 0;
c.green = 255;
c.blue = 255;
edges = new_matrix(4, 4);
transform = new_matrix(4, 4);
if ( argc == 2 )
parse_file( argv[1], transform, edges, s );
else
parse_file( "stdin", transform, edges, s );
add_edge( edges, 250,0,0, 250,25,0 );//M
add_edge( edges, 250,25,0, 263,0,0 );
add_edge( edges, 263,0,0, 275,25,0 );
add_edge( edges, 275,25,0, 275,0,0 );
add_edge( edges, 280,0,0, 293,25,0 );//A
add_edge( edges, 293,25,0, 305,0,0 );
add_edge( edges, 287,13,0, 299,13,0 );
add_edge( edges, 310,0,0, 325,25,0 );//Y
add_edge( edges, 318,13,0, 305,25,0 );
add_edge( edges, 330,0,0, 343,25,0 );//A
add_edge( edges, 343,25,0, 355,0,0 );
add_edge( edges, 337,13,0, 349,13,0 );
add_edge( edges, 360,0,0, 360,25,0 );//N
add_edge( edges, 360,25,0, 385,0,0 );
add_edge( edges, 385,0,0, 385,25,0 );
add_edge( edges, 390,0,0, 390,25,0 );//K
add_edge( edges, 390,13,0, 408,25,0 );
add_edge( edges, 395,14,0, 408,0,0 );
draw_lines(edges, s, c);
save_extension(s, "dimensional.png");
display(s);
free_matrix( transform );
free_matrix( edges );
}
开发者ID:mayankvanjani,项目名称:mayank_el_3D,代码行数:44,代码来源:main.c
示例13: switch
void rasterizer::draw()
{
if (indices_.empty() || wvp_.empty()) {
return;
}
const auto& desc = state_->get_desc();
switch (desc.prim_) {
case pt_point:
break;
case pt_line:
draw_lines();
break;
case pt_triangle:
draw_triangles();
break;
case pt_none:
default:
break;
}
}
开发者ID:nomadfighter,项目名称:softcore,代码行数:20,代码来源:rasterizer.cpp
示例14: draw_letter
void draw_letter (letter_t* let, color_t c, color_t oc, bool is_fill) {
// printf("LET %c: ", let->c);
if (is_fill) {
for (int i = 0; i < let->lines.size(); i++) {
letter_lines_t* lines = let->lines[i];
glColor4f(oc[0], oc[1], oc[2], oc[3]);
draw_fat_lines(&lines->points, 0.2);
}
for (int i = 0; i < let->lines.size(); i++) {
letter_lines_t* lines = let->lines[i];
glColor4f(c[0], c[1], c[2], c[3]);
draw_fat_lines(&lines->points, 0.1);
}
} else {
for (int i = 0; i < let->lines.size(); i++) {
letter_lines_t* lines = let->lines[i];
glColor4f(c[0], c[1], c[2], c[3]);
draw_lines(&lines->points, GL_LINE_STRIP);
}
}
}
开发者ID:jackbackrack,项目名称:gui,代码行数:21,代码来源:draw.cpp
示例15: gtk_vi_screen_refresh
void
gtk_vi_screen_refresh(GtkViScreen *vi)
{
if (vi->lastx != vi->curx || vi->lasty != vi-> cury) {
mark_lines(vi, vi->lasty,
vi->lastx ? *ColAt(vi,vi->lasty,vi->lastx-1) + 1 : 0,
vi->lasty+1, *ColAt(vi,vi->lasty,vi->lastx)+1);
mark_lines(vi, vi->cury,
vi->curx ? *ColAt(vi,vi->cury,vi->curx-1) + 1 : 0,
vi->cury+1, *ColAt(vi,vi->cury,vi->curx)+1);
}
if (vi->marked_maxy == 0)
return;
draw_lines(vi, vi->marked_y, vi->marked_x, vi->marked_maxy, vi->marked_maxx);
vi->marked_x = vi->cols;
vi->marked_y = vi->rows;
vi->marked_maxx = 0;
vi->marked_maxy = 0;
vi->lastx = vi->curx;
vi->lasty = vi->cury;
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:21,代码来源:gtkviscreen.c
示例16: main
int main() {
screen s;
color c;
c.red = 255;
c.green = 0;
c.blue = 0;
int i, j;
for( i=0; i<XRES; i++) {
for ( j=0; j<YRES; j++) {
plot( s, c, i, j);
}
}
c.red = 0;
c.green = 0;
c.blue = 0;
int d = 0;
struct matrix *picture = new_matrix(3,3);
while(d < XRES){
add_edge(picture, d, XRES-d, 1, XRES, d+d, 1);
d++;
}
draw_lines(picture, s, c);
// display( s );
save_ppm(s, "picture.ppm" );
// save_extension(s, "image.jpg");
}
开发者ID:stuydw,项目名称:matrix,代码行数:39,代码来源:main.c
示例17: main
//.........这里部分代码省略.........
}
if (sscanf(buffer, "D,%d", &pid) == 1) {
delete_player(players, &player_count, pid);
printf("%d other players are online\n", player_count);
}
}
for (int i = 0; i < chunk_count; i++) {
Chunk *chunk = chunks + i;
if (chunk->dirty) {
update_chunk(chunk);
}
}
int p = floorf(roundf(x) / CHUNK_SIZE);
int q = floorf(roundf(z) / CHUNK_SIZE);
ensure_chunks(chunks, &chunk_count, p, q, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
update_matrix_3d(matrix, x, y, z, rx, ry);
// render chunks
glUseProgram(block_program);
glUniformMatrix4fv(matrix_loc, 1, GL_FALSE, matrix);
glUniform3f(camera_loc, x, y, z);
glUniform1i(sampler_loc, 0);
glUniform1f(timer_loc, glfwGetTime());
for (int i = 0; i < chunk_count; i++) {
Chunk *chunk = chunks + i;
if (chunk_distance(chunk, p, q) > RENDER_CHUNK_RADIUS) {
continue;
}
if (!chunk_visible(chunk, matrix)) {
continue;
}
draw_chunk(chunk, position_loc, normal_loc, uv_loc);
}
// render players
for (int i = 0; i < player_count; i++) {
Player *player = players + i;
draw_player(player, position_loc, normal_loc, uv_loc);
}
// render focused block wireframe
int hx, hy, hz;
int hw = hit_test(
chunks, chunk_count, 0, x, y, z, rx, ry, &hx, &hy, &hz);
if (is_obstacle(hw)) {
glUseProgram(line_program);
glLineWidth(1);
glEnable(GL_COLOR_LOGIC_OP);
glUniformMatrix4fv(line_matrix_loc, 1, GL_FALSE, matrix);
GLuint cube_buffer = make_cube_buffer(hx, hy, hz, 0.51);
draw_lines(cube_buffer, line_position_loc, 3, 48);
glDeleteBuffers(1, &cube_buffer);
glDisable(GL_COLOR_LOGIC_OP);
}
update_matrix_2d(matrix);
// render crosshairs
glUseProgram(line_program);
glLineWidth(4);
glEnable(GL_COLOR_LOGIC_OP);
glUniformMatrix4fv(line_matrix_loc, 1, GL_FALSE, matrix);
GLuint line_buffer = make_line_buffer();
draw_lines(line_buffer, line_position_loc, 2, 4);
glDeleteBuffers(1, &line_buffer);
glDisable(GL_COLOR_LOGIC_OP);
// render selected item
update_matrix_item(matrix);
if (block_type != previous_block_type) {
previous_block_type = block_type;
make_single_cube(
&item_position_buffer, &item_normal_buffer, &item_uv_buffer,
0, 0, 0, 0.5, block_type);
}
glUseProgram(block_program);
glUniformMatrix4fv(matrix_loc, 1, GL_FALSE, matrix);
glUniform3f(camera_loc, 0, 0, 5);
glUniform1i(sampler_loc, 0);
glUniform1f(timer_loc, glfwGetTime());
glDisable(GL_DEPTH_TEST);
draw_single_cube(
item_position_buffer, item_normal_buffer, item_uv_buffer,
position_loc, normal_loc, uv_loc);
glEnable(GL_DEPTH_TEST);
glfwSwapBuffers(window);
glfwPollEvents();
}
client_stop();
db_save_state(x, y, z, rx, ry);
db_close();
glfwTerminate();
return 0;
}
开发者ID:kanitaoru,项目名称:Craft,代码行数:101,代码来源:main.c
示例18: main
int main() {
//Basic Matrix Math
struct matrix *a;
struct matrix *b;
a=new_matrix(4,4);
b=new_matrix(4,2);
printf("Identity matrix:\n");
ident(a);
print_matrix(a);
b->m[0][0]=1;
b->m[0][1]=2;
b->m[1][0]=3;
b->m[1][1]=4;
b->m[2][0]=5;
b->m[2][1]=6;
b->m[3][0]=7;
b->m[3][1]=8;
printf("Matrix #2:\n");
print_matrix(b);
printf("Scalar Multiplication by 2:\n");
scalar_mult(2, b);
print_matrix(b);
printf("New Matrix #1:\n");
a->m[2][1]=3;
a->m[0][3]=2;
print_matrix(a);
printf("Matrix Multiplication:\n");
matrix_mult(a, b);
print_matrix(b);
printf("Adding points/edges:\n");
struct matrix *d;
d = new_matrix(3, 3);
add_point(d, 200,400,70);
add_point(d, 200,0,7);
print_matrix(d);
printf("\n");
add_edge(d, 300,500,100,300,100,134);
add_edge(d, 100,500,100,100,100,134);
add_edge(d, 400,00,100,400,400,134);
print_matrix(d);
printf("\n");
screen s;
color c;
c.red = 200;
c.green = 100;
c.blue = 250;
int i, j;
for( i=0; i<XRES; i++)
for ( j=0; j<YRES; j++) {
plot( s, c, i, j);
}
c.red=0;
c.green=200;
c.blue=200;
draw_lines(d, s, c);
display( s );
save_ppm(s, "image" );
save_extension(s, "image.jpg");
}
开发者ID:stuydw,项目名称:matrix,代码行数:80,代码来源:main.c
示例19: arguemnts
//.........这里部分代码省略.........
add_box(pm, x, y, z, width, height, depth);
//printf( "%lf %lf %lf\n", x, y, z);
}
else if ( strncmp(line, "sphere", strlen(line)) == 0 ) {
//printf("SPHERE\n");
fgets(line, 255, f);
sscanf(line, "%lf %lf %lf", &x, &y, &radius);
add_sphere(pm, x, y, radius, 0.01);
//printf( "%lf %lf %lf\n", x, y, z);
}
else if ( strncmp(line, "torus", strlen(line)) == 0 ) {
//printf("TORUS\n");ds
fgets(line, 255, f);
sscanf(line, "%lf %lf %lf %lf", &x, &y, &radius1, &radius2 );
add_torus(pm, x, y, radius1, radius2, 0.01);
//printf( "%lf %lf %lf\n", x, y, z);
}
else if ( strncmp(line, "scale", strlen(line)) == 0 ) {
//printf("SCALE\n");
fgets(line, 255, f);
//line[strlen(line)-1]='\0';
sscanf(line, "%lf %lf %lf", &x, &y, &z);
tmp = make_scale(x, y, z);
matrix_mult(tmp, transform);
//print_matrix(transform);
}
else if ( strncmp(line, "translate", strlen(line)) == 0 ) {
//printf("TRANSLATE\n");
fgets(line, 255, f);
// line[strlen(line)-1]='\0';
sscanf(line, "%lf %lf %lf", &x, &y, &z);
tmp = make_translate(x, y, z);
matrix_mult(tmp, transform);
//print_matrix(transform);
}
else if ( strncmp(line, "xrotate", strlen(line)) == 0 ) {
//printf("ROTATE!\n");
fgets(line, 255, f);
sscanf(line, "%lf", &angle);
angle = angle * (M_PI / 180);
tmp = make_rotX( angle);
matrix_mult(tmp, transform);
}
else if ( strncmp(line, "yrotate", strlen(line)) == 0 ) {
//printf("ROTATE!\n");
fgets(line, 255, f);
sscanf(line, "%lf", &angle);
angle = angle * (M_PI / 180);
tmp = make_rotY( angle);
matrix_mult(tmp, transform);
}
else if ( strncmp(line, "zrotate", strlen(line)) == 0 ) {
//printf("ROTATE!\n");
fgets(line, 255, f);
sscanf(line, "%lf", &angle);
angle = angle * (M_PI / 180);
tmp = make_rotZ( angle);
matrix_mult(tmp, transform);
}
else if ( strncmp(line, "ident", strlen(line)) == 0 ) {
ident(transform);
}
else if ( strncmp(line, "apply", strlen(line)) == 0 ) {
//printf("APPLY!\n");
//print_matrix( transform );
// print_matrix(pm);
matrix_mult(transform, pm);
}
else if ( strncmp(line, "display", strlen(line)) == 0 ) {
clear_screen(s);
draw_lines(pm, s, g);
display(s);
}
else if ( strncmp(line, "save", strlen(line)) == 0 ) {
fgets(line, 255, f);
// line[strlen(line)-1] = '\0';
clear_screen(s);
draw_lines(pm, s, g);
save_extension(s, line);
}
else if ( strncmp(line, "clear", strlen(line)) == 0 ) {
fgets(line, 255, f);
// line[strlen(line)-1] = '\0';
clear_screen(s);
}
else if ( strncmp(line, "quit", strlen(line)) == 0 ) {
return;
}
else if (strncmp(line, "#", strlen(1)) == 0){
}
else {
printf("Invalid command\n");
}
}
free_matrix(tmp);
fclose(f);
//printf("END PARSE\n");
}
开发者ID:nspektor,项目名称:3dHW,代码行数:101,代码来源:parser.c
示例20: source
/*======== void my_main() ==========
Inputs: int polygons
Returns:
This is the main engine of the interpreter, it should
handle most of the commadns in mdl.
If frames is not present in the source (and therefore
num_frames is 1, then process_knobs should be called.
If frames is present, the enitre op array must be
applied frames time. At the end of each frame iteration
save the current screen to a file named the
provided basename plus a numeric string such that the
files will be listed in order, then clear the screen and
reset any other data structures that need it.
Important note: you cannot just name your files in
regular sequence, like pic0, pic1, pic2, pic3... if that
is done, then pic1, pic10, pic11... will come before pic2
and so on. In order to keep things clear, add leading 0s
to the numeric portion of the name. If you use sprintf,
you can use "%0xd" for this purpose. It will add at most
x 0s in front of a number, if needed, so if used correctly,
and x = 4, you would get numbers like 0001, 0002, 0011,
0487
05/17/12 09:41:35
jdyrlandweaver
====================*/
void
my_main (int polygons)
{
int i, f, j;
double step;
double xval, yval, zval, knob_value;
struct matrix *transform;
struct matrix *tmp;
struct stack *s;
screen t;
color g;
char q;
num_frames = 1;
step = 0.05;
g.red = 0;
g.green = 255;
g.blue = 255;
s = new_stack ();
tmp = new_matrix (4, 1000);
clear_screen (t);
for (i = 0; i < lastop; i++)
{
switch (op[i].opcode)
{
case SPHERE:
add_sphere (tmp, op[i].op.sphere.d[0], //cx
op[i].op.sphere.d[1], //cy
op[i].op.sphere.d[2], //cz
op[i].op.sphere.r, step);
//apply the current top origin
matrix_mult (s->data[s->top], tmp);
draw_polygons (tmp, t, g);
tmp->lastcol = 0;
break;
case TORUS:
add_torus (tmp, op[i].op.torus.d[0], //cx
op[i].op.torus.d[1], //cy
op[i].op.torus.d[2], //cz
op[i].op.torus.r0, op[i].op.torus.r1, step);
matrix_mult (s->data[s->top], tmp);
draw_polygons (tmp, t, g);
tmp->lastcol = 0;
break;
case BOX:
add_box (tmp, op[i].op.box.d0[0],
op[i].op.box.d0[1],
op[i].op.box.d0[2],
op[i].op.box.d1[0],
op[i].op.box.d1[1], op[i].op.box.d1[2]);
matrix_mult (s->data[s->top], tmp);
draw_polygons (tmp, t, g);
tmp->lastcol = 0;
break;
case LINE:
add_edge (tmp, op[i].op.line.p0[0],
op[i].op.line.p0[1],
op[i].op.line.p0[1],
op[i].op.line.p1[0],
op[i].op.line.p1[1], op[i].op.line.p1[1]);
draw_lines (tmp, t, g);
//.........这里部分代码省略.........
开发者ID:stuydw,项目名称:mdl-animation,代码行数:101,代码来源:my_main.c
注:本文中的draw_lines函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论