Category : Printer + Display Graphics
Archive   : AVRIL11.ZIP
Filename : EXAMPLE5.C

 
Output of file : EXAMPLE5.C contained in archive : AVRIL11.ZIP
/* EXAMPLE5 -- manipulating a cube with the Logitech Cyberman */

/* Written by Bernie Roehl, August 1994 */

#include

#include "avril.h"
#include "avrildrv.h"

vrl_Object *cube = NULL;

static void cube_mover(void)
{
vrl_Device *dev = vrl_TaskGetData();
vrl_Object *viewer = vrl_CameraGetObject(vrl_WorldGetCamera());
vrl_Vector v;
if (dev->buttons)
{
vrl_ObjectRotReset(cube);
vrl_ObjectRotY(cube, float2angle(45));
vrl_ObjectVectorMove(cube, vrl_VectorNULL);
}
vrl_ObjectRotate(cube, vrl_DeviceGetValue(dev, YROT), Y, VRL_COORD_OBJREL, viewer);
vrl_ObjectRotate(cube, vrl_DeviceGetValue(dev, XROT), X, VRL_COORD_OBJREL, viewer);
vrl_ObjectRotate(cube, vrl_DeviceGetValue(dev, ZROT), Z, VRL_COORD_OBJREL, viewer);
vrl_VectorCreate(v, vrl_DeviceGetValue(dev, X), vrl_DeviceGetValue(dev, Y), vrl_DeviceGetValue(dev, Z));
vrl_ObjectTranslate(cube, v, VRL_COORD_OBJREL, viewer);
vrl_SystemRequestRefresh();
}

void main()
{
vrl_Light *light;
vrl_Camera *camera;
vrl_Device *dev;

vrl_SystemStartup();

cube = vrl_ObjectCreate(vrl_PrimitiveBox(100, 100, 100, NULL));
vrl_ObjectRotY(cube, float2angle(45));

light = vrl_LightCreate();
vrl_LightRotY(light, float2angle(45));
vrl_LightRotX(light, float2angle(45));

camera = vrl_CameraCreate();
vrl_CameraRotX(camera, float2angle(45));
vrl_CameraMove(camera, 0, 500, -500);

dev = vrl_DeviceOpen(vrl_CybermanDevice, vrl_SerialOpen(0x2F8, 3, 2000));
if (dev)
{
vrl_DeviceSetScale(dev, X, float2scalar(50));
vrl_DeviceSetScale(dev, Y, float2scalar(50));
vrl_DeviceSetScale(dev, Z, float2scalar(50));
vrl_TaskCreate(cube_mover, dev, 0);
}

vrl_SystemRun();
}



  3 Responses to “Category : Printer + Display Graphics
Archive   : AVRIL11.ZIP
Filename : EXAMPLE5.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/