コード例 #1
0
ファイル: draw.c プロジェクト: GavinHigham/Sock_Engine
void draw_wireframe(EFFECT *e, struct buffer_group bg, amat4 model_matrix)
{
    glBindVertexArray(bg.vao);
    GLfloat mvpm[16];
    GLfloat model_matrix_buf[16];
    amat4_to_array(model_matrix, model_matrix_buf);
    amat4_buf_mult(proj_view_mat, model_matrix_buf, mvpm);
    drawf("-m", e->model_view_projection_matrix, mvpm);
    glDrawElements(bg.primitive_type, bg.index_count, GL_UNSIGNED_INT, NULL);
}
コード例 #2
0
ファイル: draw.c プロジェクト: GavinHigham/Sock_Engine
void draw_skybox_forward(EFFECT *e, struct buffer_group bg, amat4 model_matrix)
{
    glBindVertexArray(bg.vao);
    GLfloat mvpm[16];
    GLfloat mm[16];
    amat4_to_array(model_matrix, mm);
    amat4_buf_mult(proj_view_mat, mm, mvpm);
    drawf("-m-m-*3f-*3f", e->model_matrix, mm, e->model_view_projection_matrix, mvpm, e->camera_position, model_matrix.T, e->sun_direction, sun_direction.A);
    glDrawElements(GL_TRIANGLES, bg.index_count, GL_UNSIGNED_INT, NULL);
}
コード例 #3
0
ファイル: draw.c プロジェクト: GavinHigham/Sock_Engine
void draw_forward(EFFECT *e, struct buffer_group bg, amat4 model_matrix)
{
    glBindVertexArray(bg.vao);
    GLfloat mm[16];
    GLfloat mvpm[16];
    GLfloat nmvm[16];
    amat4_to_array(model_matrix, mm);
    amat4_buf_mult(proj_view_mat, mm, mvpm);
    mat3_vec3_to_array(mat3_transp(model_matrix.a), (vec3) {
        {
            0, 0, 0
        }
    }, nmvm);
    drawf("-m-m-m", e->model_matrix, mm, e->model_view_projection_matrix, mvpm, e->model_view_normal_matrix, nmvm);
    glDrawElements(bg.primitive_type, bg.index_count, GL_UNSIGNED_INT, NULL);
}
コード例 #4
0
ファイル: main.c プロジェクト: Gigaraptor/strawbs
int main(){
	clock_t timelim;
	init();
	printw("Strawb catcher version 1\n");
	printw("\t\tPress F1 or ESC to quit");
	entity p;
	p.x = 10;
	p.y = 20;
	p.display = '@';
	p.score = 0;
	p.colour = 2;
	entity *playerptr = &p;
	entity fr[10];
	entity *fruitpointer = &fr;
	int i;
	definestats(fruitpointer);
	timelim = clock();
	int escape;
	
	while(1 == 1){
		int score = p.score;
		int o = 0;
		mvprintw(0,30,"Score : %d", score);
		movep(playerptr);
		draw(playerptr);
		collision(fruitpointer, playerptr);
		drawf(fruitpointer);
		timelim = clock() - timelim;
		escape = ((int)timelim)/CLOCKS_PER_SEC;
		mvprintw(0, 60,"Seconds : %d", ((int)timelim)/CLOCKS_PER_SEC);
		if(escape > 30){
		
			int d = 0;
			int displayscore = p.score;
			
			clear();
			mvprintw(10, 20, "Congratulations, you have scored %d points\n", displayscore);
			refresh();
			wait(10);
			deinit();
			}
	}
	



}
コード例 #5
0
void veraFscene::draw(){
    
//    sizeOfF = dimensions.width/numberOfF;
    sizeOfF = 20.0;
    
//    if (sizeOfF > dimensions.width-(sizeOfF*(numberOfF-1))) {
//        offset = (dimensions.width - sizeOfF*(numberOfF-1))/2;
//    } else {
//        offset = (dimensions.width - sizeOfF*(numberOfF))/2;
//    }
    
    float drawnSize = sizeOfF * numberOfF;
    ofPushMatrix();
    ofTranslate(dimensions.width / 2.0, dimensions.height / 2.0);
    ofScale(zoom, zoom);
    ofPushMatrix();
    ofTranslate(-drawnSize / 2.0, -drawnSize / 2.0);
    
    
    ofSetColor(255);
    ofSetLineWidth(lineWidth * zoom);
    
    for (int i = 0; i< numberOfF; i++){
        for (int j = 0; j< numberOfF; j++) {
            ofPushMatrix();
            ofTranslate(i*sizeOfF, j*sizeOfF);
            float rand = ofNoise(i,j, ofGetElapsedTimef());
            if (rand < frequency) {
                if (rand < frequency / 3.0) {
                    ofScale(-1, 1);
                } else if (rand < frequency * 2.0 / 3.0) {
                    ofScale(-1, -1);
                } else {
                    ofScale(1, -1);
                }
            }
            drawf();
            
            ofPopMatrix();
        }
    }
    ofPopMatrix();
    ofPopMatrix();
}
コード例 #6
0
ファイル: draw.c プロジェクト: GavinHigham/Sock_Engine
void draw_forward_adjacent(EFFECT *e, struct buffer_group bg, amat4 model_matrix)
{
    glBindVertexArray(bg.vao);
    GLfloat mvpm[16];
    GLfloat mm[16];
    GLfloat mvnm[16];
    amat4_to_array(model_matrix, mm);
    amat4_buf_mult(proj_view_mat, mm, mvpm);
    mat3_vec3_to_array(mat3_transp(model_matrix.a), (vec3) {
        {
            0, 0, 0
        }
    }, mvnm);
    drawf("-m-m-m", e->model_matrix, mm, e->model_view_projection_matrix, mvpm, e->model_view_normal_matrix, mvnm);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bg.aibo);
    glDrawElements(GL_TRIANGLES_ADJACENCY, bg.index_count*2, GL_UNSIGNED_INT, NULL);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bg.ibo);
    checkErrors("After drawing with aibo");
}
コード例 #7
0
ファイル: Font.hpp プロジェクト: SpaceManiac/ALX
 /**
     Printf-style draw with flags = 0.
     @param x target x coordinate.
     @param y target y coordinate.
     @param color color.
     @param format printf-style format.
     @param args arguments.
  */
 void drawf(float x, float y, ALLEGRO_COLOR color, const char *format, va_list args) const {
     drawf(x, y, 0, color, format, args);
 }
コード例 #8
0
ファイル: Font.hpp プロジェクト: SpaceManiac/ALX
 /**
     Printf-style draw with flags = 0.
     @param x target x coordinate.
     @param y target y coordinate.
     @param color color.
     @param format printf-style format.
     @param ... printf-style arguments.
  */
 void drawf(float x, float y, ALLEGRO_COLOR color, const char *format, ...) const {
     va_list args;
     va_start(args, format);
     drawf(x, y, 0, color, format, args);
     va_end(args);
 }