}
// add bytes at end of each row so total # is a multiple of 4
// round up 3*numCols to next mult, of 4

// добавляем байты в конец каждой строки так, чтобы

// общее количество было кратно 4

// округляем в большую сторону 3*numCols до следующей

// степени 4

nBytesInRow - ((3 * numCols + 3)/4) * 4: numPadBytes - nBytesInRow - 3 * numCols: // need this many // необходимо такое количество Приложение В. Некоторые полезные классы и служебные подпрограммы

nRows - numRows:
// set class's data members

// устанавливаем элементы данных класса

nCols - numCols:
pixel - new mR6B[nRows * nCols]:
// make space for array

// выделяем пространство для массива

if(lpixel) return 0;
// out of memory!

// нехватка памяти!

long count - 0:
char dum:
for(row - 0: row < nRows: row++)
// read pixel values

// читаем значения пикселов

{
for(col - 0: col < nCols: col++) {
char r.g.b:

inf.get(b): inf.get(g): inf.get(r): // читаем байты/Zread bytes

pixel[count].r - r: // place them in colors // отправляем их в цвета

pixel[count].g - g:
pixel[count++].b - b;
}

for(k - 0: k < numPadBytes : k++) // skip pad bytes at row's end // пропускаем незначащие байты в конце строки

inf » dum:
}

inf.closeO: return 1: // success // успешно }

ВЗ. Класс SCENE и сопутствующие классы

// SDL.h
// definition of simple support classes:

// определение простых сопутствующих классов:

#ifndef _SDL
#define _SDL
#include <string>
#include <1ostream>
♦include <fstream>
♦include <strstream>
using namespace std:
♦include <windows.h> ♦include <assert.h>

ВЗ. Класс SCENE и сопутствующие классы

#include <math.h> finclude <gl/Gl.h> #include <gl/Glu.h> #include <gl/glut.h>
// include RGBpixmap if you wish to add a pix map field to Scene:

// включаем RGBpixmap. если хотим добавить поле пиксельной // карты к Scene:

nclude "RGBpixmap.h"

//mimmmmm рошз class mommmm

class Point3{ public:
float x.y.z:

void set(float dx. float dy. float dz){x - dx: у - dy: z - dz:} void set(Point3& p){x - p.x: у - p.у: z - p.z:} Point3(float xx. float yy. float zz){x - xx: у - yy: z - zz:} Point3(){x - у - z - 0:} void build4tuple(float v[])


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