Компьютерная графика.-Полигональные модели Ниже приводим пример программы, реализующей текстурирование верти ных поверхностей.

II File doom4.cpp #ifdef _WATCOMC__ #include <i86.h> #endif
#include <bios.h> #include <dos.h> #include <malloc.h> #include <math.h> #include <stdio.h> #include <time.h>
#include "wad.fT
#include "texdict.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
#define VJvllN 20
#define HSCALE 1601
#define VSCALE . 1601
#define FLOOR_COLOR 8
#define CEILING_COLOR 7
#define WALL_COLOR 1
#define LOWER_WALL_COLOR 2
#define UPPER_WALL_COLOR 3
#define ESC 0x011b
#define UP 0x4800
#define DOWN 0x5000
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define CtriLeft 0x7300
#define CtrlRight 0x7400
struct VertexCache {
int u; int v; int c; int frame;
struct DPMIDosPtr {
unsigned short segment; unsigned short selector;
>
HillIIIIIllilllIIllllll Static Data lllllllllllllllllllllllllllll struct
{
unsigned long edi; unsigned long esi;

13. Элементы виртуальной реальност

unsigned long ebp; unsigned long esp; unsigned long ebx; , unsigned long edx; unsigned long ecx; unsigned long eax; unsigned short flags;
unsigned short es, ds, fs, gs, ip, cs, sp, ss; } rmRegs;
REGS regs;
SREGS sregs;
int locX; // viewer's location
int locY;
int locZ; // viewer height
Angle angle; // viewing direction
SSector * curSector; // ssector, viewer located in
long totalFrames = 0;
int topLine [SCREEN_WIDTH]; // top horizon line
int bottomLine [SCREEN_WIDTH]; // bottom horizon line
int colsLeft; // # on unfinished columns
char colFilled [SCREEN_WIDTH]; // whether column is already filled
VertexCache * vertexCache;
WadFile wad ( "E:\\GAMES\\DOOM.ULT\\DOOM.WAD" );
TextureDictionary texDict ( &wad );
lllllllllllllllll/llllllllll/lllllllllllllllllllllllllllllllllllll

⇐ Предыдущая| |Следующая ⇒