Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Color{
- int wavelength;
- double R;
- double G;
- double B;
- Color(){}
- Color(int w,double r,double g,double b):wavelength(w),R(r),G(g),B(b){}
- };
- Color szinek[115];
- void cut(Point* t, int size){
- Point* temp = new Point[size];
- int temp_size = size;
- int j = 0;
- for(int i = 0; i < size; i++)
- temp[i] = t[i];
- float* color_t = new float[3];
- glBegin(GL_TRIANGLES);
- for(int i = 2; i < temp_size; i++){
- if(isEar(temp[i-2],temp[i-1],temp[i], t, size)){
- glShadeModel(GL_SMOOTH);
- color(color_t,j);
- glColor3f(color_t[0],color_t[1],color_t[2]);
- glVertex2f(temp[i-2].x,temp[i-2].y);
- glVertex2f(temp[i-1].x,temp[i-1].y);
- glVertex2f(temp[i].x,temp[i].y);
- temp = delete_point(temp, i-1, temp_size);
- temp_size--;
- j++;
- //cout << j << ". HAROMSZOG RAJZOL" << endl;
- //cout << "HATRALEVO PONTOK SZAMA: " << temp_size << endl;
- i = 2;
- }
- }
- glVertex2f(temp[0].x,temp[0].y);
- glVertex2f(temp[1].x,temp[1].y);
- glVertex2f(temp[2].x,temp[2].y);
- cout << "CUT OK" << endl;
- glEnd();
- }
- void color(float* color_t,int i){
- int color_index = (i % 115);
- cout << color_index << endl;
- color_t[0] = (float)szinek[color_index].R;
- color_t[1] = (float)szinek[color_index].G;
- color_t[2] = (float)szinek[color_index].B;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement