Data update
This commit is contained in:
parent
61b93a2cd1
commit
5af6d93694
858 changed files with 20572 additions and 2082 deletions
|
|
@ -0,0 +1,35 @@
|
|||
100 cls
|
||||
110 graphics 0
|
||||
120 graphics color 0,0,0
|
||||
130 while true
|
||||
140 graphics cls
|
||||
150 x = cos(t)*20
|
||||
160 y = sin(t)*18
|
||||
170 r = sin(t+t)
|
||||
180 moveto (x+40),(y+40-r)
|
||||
190 lineto (-y+40),(x+40-r)
|
||||
200 moveto (-y+40),(x+40-r)
|
||||
210 lineto (-x+40),(-y+40-r)
|
||||
220 moveto (-x+40),(-y+40-r)
|
||||
230 lineto (y+40),(-x+40-r)
|
||||
240 moveto (y+40),(-x+40-r)
|
||||
250 lineto (x+40),(y+40-r)
|
||||
260 moveto (x+40),(y+20+r)
|
||||
270 lineto (-y+40),(x+20+r)
|
||||
280 moveto (-y+40),(x+20+r)
|
||||
290 lineto (-x+40),(-y+20+r)
|
||||
300 moveto (-x+40),(-y+20+r)
|
||||
310 lineto (y+40),(-x+20+r)
|
||||
320 moveto (y+40),(-x+20+r)
|
||||
330 lineto (x+40),(y+20+r)
|
||||
340 moveto (x+40),(y+40-r)
|
||||
350 lineto (x+40),(y+20+r)
|
||||
360 moveto (-y+40),(x+40-r)
|
||||
370 lineto (-y+40),(x+20+r)
|
||||
380 moveto (-x+40),(-y+40-r)
|
||||
390 lineto (-x+40),(-y+20+r)
|
||||
400 moveto (y+40),(-x+40-r)
|
||||
410 lineto (y+40),(-x+20+r)
|
||||
420 for i = 1 to 1000 : next i
|
||||
430 t = t+0.15
|
||||
440 wend
|
||||
108
Task/Draw-a-rotating-cube/Evaldraw/draw-a-rotating-cube.evaldraw
Normal file
108
Task/Draw-a-rotating-cube/Evaldraw/draw-a-rotating-cube.evaldraw
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
// We can define our own vec3 struct
|
||||
struct vec3{x,y,z;}
|
||||
static modelMatrix[9];
|
||||
() {
|
||||
cls(0x828282); // clear screen
|
||||
clz(1e32); // clear depth buffer
|
||||
setcam(0,0,-3,0,0); // set camera some units back
|
||||
|
||||
// create two local arrays to hold rotation matrices
|
||||
double roty[9], rotz[9];
|
||||
|
||||
static otim;
|
||||
tim=klock(0); dt=tim-otim; otim=tim;
|
||||
static degrees = 0;
|
||||
degrees+=200*dt;
|
||||
rads = degrees/180*pi;
|
||||
rotateZ( rotz, rads );
|
||||
rotateY( roty, rads );
|
||||
|
||||
// evaldraw does support some GL-like drawing
|
||||
// modes, but any transformations must be done by hand
|
||||
// Here we use a global model matrix that
|
||||
// transforms vertices created by the myVertex function
|
||||
mult(modelMatrix, roty, rotz);
|
||||
glSetTex("cloud.png");
|
||||
drawcuboid(0,0,0,1,1,1);
|
||||
}
|
||||
|
||||
drawcuboid(x,y,z,sx,sy,sz) {
|
||||
glBegin(GL_QUADS);
|
||||
setcol(192,32,32);
|
||||
glTexCoord(0,0); myVertex(x-sx,y-sy,z-sz);
|
||||
glTexCoord(1,0); myVertex(x+sx,y-sy,z-sz);
|
||||
glTexCoord(1,1); myVertex(x+sx,y+sy,z-sz);
|
||||
glTexCoord(0,1); myVertex(x-sx,y+sy,z-sz);
|
||||
|
||||
setcol(32,192,32);
|
||||
glTexCoord(0,0); myVertex(x-sx,y-sy,z+sz);
|
||||
glTexCoord(1,0); myVertex(x-sx,y-sy,z-sz);
|
||||
glTexCoord(1,1); myVertex(x-sx,y+sy,z-sz);
|
||||
glTexCoord(0,1); myVertex(x-sx,y+sy,z+sz);
|
||||
|
||||
setcol(32,32,192);
|
||||
glTexCoord(0,0); myVertex(x+sx,y-sy,z+sz);
|
||||
glTexCoord(1,0); myVertex(x-sx,y-sy,z+sz);
|
||||
glTexCoord(1,1); myVertex(x-sx,y+sy,z+sz);
|
||||
glTexCoord(0,1); myVertex(x+sx,y+sy,z+sz);
|
||||
|
||||
setcol(192,192,32);
|
||||
glTexCoord(0,0); myVertex(x+sx,y-sy,z-sz);
|
||||
glTexCoord(1,0); myVertex(x+sx,y-sy,z+sz);
|
||||
glTexCoord(1,1); myVertex(x+sx,y+sy,z+sz);
|
||||
glTexCoord(0,1); myVertex(x+sx,y+sy,z-sz);
|
||||
|
||||
setcol(192,32,192);
|
||||
glTexCoord(0,0); myVertex(x-sx,y-sy,z+sz);
|
||||
glTexCoord(1,0); myVertex(x+sx,y-sy,z+sz);
|
||||
glTexCoord(1,1); myVertex(x+sx,y-sy,z-sz);
|
||||
glTexCoord(0,1); myVertex(x-sx,y-sy,z-sz);
|
||||
|
||||
setcol(32,192,192);
|
||||
glTexCoord(0,0); myVertex(x-sx,y+sy,z-sz);
|
||||
glTexCoord(1,0); myVertex(x+sx,y+sy,z-sz);
|
||||
glTexCoord(1,1); myVertex(x+sx,y+sy,z+sz);
|
||||
glTexCoord(0,1); myVertex(x-sx,y+sy,z+sz);
|
||||
glEnd();
|
||||
}
|
||||
myVertex(x,y,z) {
|
||||
// Initialize a struct value
|
||||
vec3 v = {x,y,z};
|
||||
|
||||
// Apply global model matrix transformation
|
||||
transformPoint(v, modelMatrix);
|
||||
|
||||
// Submit the vertex to draw list
|
||||
glVertex(v.x, v.y, v.z);
|
||||
}
|
||||
rotateY(m[9], r) {
|
||||
c = cos(r); s=sin(r);
|
||||
m[0] = c; m[1] = 0; m[2] = s;
|
||||
m[3] = 0; m[4] = 1; m[5] = 0;
|
||||
m[6] = -s; m[7] = 0; m[8] = c;
|
||||
}
|
||||
|
||||
rotateZ(m[9], r) {
|
||||
c = cos(r); s=sin(r);
|
||||
m[0] = c; m[1] = -s; m[2] = 0;
|
||||
m[3] = s; m[4] = c; m[5] = 0;
|
||||
m[6] = 0; m[7] = 0; m[8] = 1;
|
||||
}
|
||||
transformPoint(vec3 v, m[9]) {
|
||||
x2 = v.x * m[0] + v.y * m[1] + v.z * m[2];
|
||||
y2 = v.x * m[3] + v.y * m[4] + v.z * m[5];
|
||||
z2 = v.x * m[6] + v.y * m[7] + v.z * m[8];
|
||||
// Mutate the struct v with new values
|
||||
v.x=x2; v.y=y2; v.z=z2;
|
||||
}
|
||||
mult(c[9],a[9],b[9]) { // C = AB
|
||||
// multiply a row in A with a column in B
|
||||
for(i=0; i<3; i++)
|
||||
for(j=0; j<3; j++) {
|
||||
sum = 0.0;
|
||||
for(k=0; k<3; k++) {
|
||||
sum += A[k*3+i] * B[k*3+j];
|
||||
}
|
||||
C[i*3+j] = sum;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
100 SCREEN 2
|
||||
110 WHILE 1
|
||||
120 CLS
|
||||
130 X = COS(T)*20
|
||||
140 Y = SIN(T)*18
|
||||
150 R = SIN(T+T)
|
||||
160 LINE (( X+40),( Y+40-R))-((-Y+40),( X+40-R))
|
||||
170 LINE ((-Y+40),( X+40-R))-((-X+40),(-Y+40-R))
|
||||
180 LINE ((-X+40),(-Y+40-R))-(( Y+40),(-X+40-R))
|
||||
190 LINE (( Y+40),(-X+40-R))-(( X+40),( Y+40-R))
|
||||
200 LINE (( X+40),( Y+20+R))-((-Y+40),( X+20+R))
|
||||
210 LINE ((-Y+40),( X+20+R))-((-X+40),(-Y+20+R))
|
||||
220 LINE ((-X+40),(-Y+20+R))-(( Y+40),(-X+20+R))
|
||||
230 LINE (( Y+40),(-X+20+R))-(( X+40),( Y+20+R))
|
||||
240 LINE (( X+40),( Y+40-R))-(( X+40),( Y+20+R))
|
||||
250 LINE ((-Y+40),( X+40-R))-((-Y+40),( X+20+R))
|
||||
260 LINE ((-X+40),(-Y+40-R))-((-X+40),(-Y+20+R))
|
||||
270 LINE (( Y+40),(-X+40-R))-(( Y+40),(-X+20+R))
|
||||
280 T = T+.15
|
||||
290 WEND
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
100 SCREEN 2
|
||||
110 COLOR 15
|
||||
120 CLS
|
||||
130 X = COS(T)*20
|
||||
140 Y = SIN(T)*18
|
||||
150 R = SIN(T+T)
|
||||
160 LINE (( X+40),( Y+40-R))-((-Y+40),( X+40-R))
|
||||
170 LINE ((-Y+40),( X+40-R))-((-X+40),(-Y+40-R))
|
||||
180 LINE ((-X+40),(-Y+40-R))-(( Y+40),(-X+40-R))
|
||||
190 LINE (( Y+40),(-X+40-R))-(( X+40),( Y+40-R))
|
||||
200 LINE (( X+40),( Y+20+R))-((-Y+40),( X+20+R))
|
||||
210 LINE ((-Y+40),( X+20+R))-((-X+40),(-Y+20+R))
|
||||
220 LINE ((-X+40),(-Y+20+R))-(( Y+40),(-X+20+R))
|
||||
230 LINE (( Y+40),(-X+20+R))-(( X+40),( Y+20+R))
|
||||
240 LINE (( X+40),( Y+40-R))-(( X+40),( Y+20+R))
|
||||
250 LINE ((-Y+40),( X+40-R))-((-Y+40),( X+20+R))
|
||||
260 LINE ((-X+40),(-Y+40-R))-((-X+40),(-Y+20+R))
|
||||
270 LINE (( Y+40),(-X+40-R))-(( Y+40),(-X+20+R))
|
||||
280 FOR I = 1 TO 40 : NEXT I
|
||||
290 T = T+0.15
|
||||
300 GOTO 120
|
||||
Loading…
Add table
Add a link
Reference in a new issue