コード例 #1
0
ファイル: walkmesh.cpp プロジェクト: berenm/xoreos
void Walkmesh::appendVertices(Common::SeekableReadStream &stream, uint32 vertexCount, uint32 vertexOffset) {
	stream.seek(vertexOffset);

	size_t prevVerticesSize = _data.vertices.size();
	uint32 verticesSize = 3 * vertexCount;
	_data.vertices.resize(prevVerticesSize + verticesSize);
	uint32 index = prevVerticesSize;

	for (uint32 i = 0; i < verticesSize; ++i) {
		_data.vertices[index++] = stream.readIEEEFloatLE();
	}
}
コード例 #2
0
ファイル: gff4file.cpp プロジェクト: Glyth/xoreos
float GFF4Struct::getFloat(Common::SeekableReadStream &data, IFieldType type) const {
	switch (type) {
		case kIFieldTypeFloat32:
			return (float) data.readIEEEFloatLE();

		case kIFieldTypeFloat64:
			return (float) data.readIEEEDoubleLE();

		case kIFieldTypeNDSFixed:
			return (float) readNintendoFixedPoint(data.readUint32LE(), true, 19, 12);

		default:
			break;
	}

	throw Common::Exception("GFF4: Field is not a float type");
}
コード例 #3
0
ファイル: model.cpp プロジェクト: Hellzed/xoreos
void Model::readValue(Common::SeekableReadStream &stream, float &value) {
	value = stream.readIEEEFloatLE();
}
コード例 #4
0
ファイル: ltrfile.cpp プロジェクト: berenm/xoreos
void LTRFile::load(Common::SeekableReadStream &stream) {
	readHeader(stream);

	if (_id != kLTRID)
		throw Common::Exception("Not a LTR file (%s)", Common::debugTag(_id).c_str());

	if (_version != kVersion10)
		throw Common::Exception("Unsupported LTR file version %s", Common::debugTag(_version).c_str());

	_letterCount = stream.readByte();
	switch (_letterCount) {
		case 26:
			_alphabet.reset(new char[26]);
			memcpy(_alphabet.get(), kLetters26, 26);
			break;
		case 28:
			_alphabet.reset(new char[28]);
			memcpy(_alphabet.get(), kLetters28, 28);
			break;
		default:
			throw Common::Exception("Unsupported Letter count %i", _letterCount);
	}

	_singleLetters.start.reset(new float[_letterCount]);
	_singleLetters.mid.reset(new float[_letterCount]);
	_singleLetters.end.reset(new float[_letterCount]);
	for (int i = 0; i < _letterCount; ++i)
		_singleLetters.start[i] = stream.readIEEEFloatLE();
	for (int i = 0; i < _letterCount; ++i)
		_singleLetters.mid[i] = stream.readIEEEFloatLE();
	for (int i = 0; i < _letterCount; ++i)
		_singleLetters.end[i] = stream.readIEEEFloatLE();

	_doubleLetters.reset(new LetterSet[_letterCount]);
	for (int i = 0; i < _letterCount; ++i) {
		_doubleLetters[i].start.reset(new float[_letterCount]);
		_doubleLetters[i].mid.reset(new float[_letterCount]);
		_doubleLetters[i].end.reset(new float[_letterCount]);
		for (int j = 0; j < _letterCount; ++j)
			_doubleLetters[i].start[j] = stream.readIEEEFloatLE();
		for (int j = 0; j < _letterCount; ++j)
			_doubleLetters[i].mid[j] = stream.readIEEEFloatLE();
		for (int j = 0; j < _letterCount; ++j)
			_doubleLetters[i].end[j] = stream.readIEEEFloatLE();
	}

	_tripleLetters.reset(new Common::ScopedArray<LetterSet>[_letterCount]);
	for (int i = 0; i < _letterCount; ++i) {
		_tripleLetters[i].reset(new LetterSet[_letterCount]);
		for (int j = 0; j < _letterCount; ++j) {
			_tripleLetters[i][j].start.reset(new float[_letterCount]);
			_tripleLetters[i][j].mid.reset(new float[_letterCount]);
			_tripleLetters[i][j].end.reset(new float[_letterCount]);
			for (int k = 0; k < _letterCount; ++k)
				_tripleLetters[i][j].start[k] = stream.readIEEEFloatLE();
			for (int k = 0; k < _letterCount; ++k)
				_tripleLetters[i][j].mid[k] = stream.readIEEEFloatLE();
			for (int k = 0; k < _letterCount; ++k)
				_tripleLetters[i][j].end[k] = stream.readIEEEFloatLE();
		}
	}
}