Exemplo n.º 1
0
ULONG W3D_DrawElements(__REGA0(W3D_Context* context), __REGD0(ULONG primitive), __REGD1(ULONG type), __REGD2(ULONG count), __REGA1(void *indices)) {
	UBYTE* bp;
	UWORD* wp;
	ULONG* lp;
	unsigned int i;
	LOG;
	bp = NULL;
	wp = NULL;
	lp = NULL;
	if (context->state & W3D_TEXMAPPING && context->CurrentTex[0]) bindTexture(context->CurrentTex[0]);
	switch (type) {
	case W3D_INDEX_UBYTE:
		bp = (UBYTE*) indices;
		_glBegin(primitives[primitive]);
		for (i = 0; i < count; ++i) {
			setColor(context, bp[i]);
			setTexture(context, bp[i]);
			drawV(context, bp[i]);
		}
		_glEnd();
		break;
	case W3D_INDEX_UWORD:
		wp = (UWORD*) indices;
		_glBegin(primitives[primitive]);
		for (i = 0; i < count; ++i) {
			setColor(context, wp[i]);
			setTexture(context, wp[i]);
			drawV(context, wp[i]);
		}
		_glEnd();
		break;
	case W3D_INDEX_ULONG:
		lp = (ULONG*) indices;
		_glBegin(primitives[primitive]);
		for (i = 0; i < count; ++i) {
			setColor(context, lp[i]);
			setTexture(context, lp[i]);
			drawV(context, lp[i]);
		}
		_glEnd();
		break;
	}
	return W3D_SUCCESS;
}
Exemplo n.º 2
0
Arquivo: Main.cpp Projeto: Seyfel/SGI
void drawVI() {
	glPushMatrix();
	glTranslatef(0.4, 0.0, 0.0);

	glPushMatrix();
	glTranslatef(-0.525, 0.05, 0);
	drawV();
	glPopMatrix();

	drawI();

	glPopMatrix();
}
Exemplo n.º 3
0
ULONG W3D_DrawArray(__REGA0(W3D_Context* context), __REGD0(ULONG primitive), __REGD1(ULONG base), __REGD2(ULONG count)) {
	unsigned int i;
	LOG;
	if (context->state & W3D_TEXMAPPING && context->CurrentTex[0]) bindTexture(context->CurrentTex[0]);
	_glBegin(primitives[primitive]);
	for (i = base; i < base + count; ++i) {
		setColor(context, i);
		setTexture(context, i);
		drawV(context, i);
	}
	_glEnd();
	return W3D_SUCCESS;
}
Exemplo n.º 4
0
static void drawV(GDISPLAY* display, PIXEL h) {
    PIXEL LW = h / 8;
    if(h > 0) {
        _displayMoveBy(display,0,1);		// top gap

        _displayTriangleBy(display, 0,0, -LW,LW, LW,LW, TRUE );
        _displayMoveBy(display,0, LW);		// move over triangle

        _displayRectangleBy(display, -LW, 0, LW,h - (1+LW+LW+1), TRUE);
        _displayMoveBy(display,0,h - (1+LW+LW+1));		// move over rectangle

        _displayTriangleBy(display, -LW,0, 0,LW, LW,0, TRUE );
        _displayMoveBy(display,0,LW);		// move over triangle

        _displayMoveBy(display,0,1);		// bottom gap
    } else {
        _displayMoveBy(display, 0, h);		// Move to top
        drawV(display,-h);					// Draw to bottom
        _displayMoveBy(display, 0, h);		// Move to top
    }
}
Exemplo n.º 5
0
static void drawMask(GDISPLAY* display,PIXEL fw,PIXEL fh,uint8_t mask, const COLOR* color) {
    _displaySetInk(display,color);

    /*
    	PIXEL oldx = display->gx;
    	PIXEL oldy = display->gy;
    */
    // Segment A
    if(mask & 0b10000000) {
        drawH(display,fw);
    } else {
        moveH(display,fw);
    }

    // Segment B
    if(mask & 0b01000000) {
        drawV(display,fh);
    } else {
        moveV(display,fh);
    }

    // Segment G
    if(mask & 0b00000010) {
        drawH(display,-fw);
        moveH(display,fw);
    }

    // Segment C
    if(mask & 0b00100000) {
        drawV(display,fh);
    } else {
        moveV(display,fh);
    }

    // Segment D
    if(mask & 0b00010000) {
        drawH(display,-fw);
    } else {
        moveH(display,-fw);
    }

    // Segment E
    if(mask & 0b00001000) {
        drawV(display,-fh);
    } else {
        moveV(display,-fh);
    }

    // Segment F
    if(mask & 0b00000100) {
        drawV(display,-fh);
    } else {
        moveV(display,-fh);
    }

    // We are now back to the top left corner
    // Segment H = full stop
    if(mask & 0b00000001) {
        PIXEL LW = fw / 4;
        if(LW<1) LW=1;

        PIXEL x,y;
        x = fw + LW * 2;
        y = fh*2 - LW;

        _displayMoveBy(display, x,y);
        _displayCircle(display, LW,TRUE);
        _displayMoveBy(display, -x, -y);
    }

    /*
    	PIXEL nowx = display->gx;
    	PIXEL nowy = display->gy;

    	if(nowx != oldx){
    		setError(1);
    	}
    	if(nowy != oldy){
    		setError(2);
    	}
    */
}