Exemple #1
0
        Mesh::Mesh(Resources::IndicesPtr indexBuffer,
                   Type type,
                   GeometrySetPtr geom,
                   MaterialPtr mat,
                   unsigned int indexOffset,
                   unsigned int drawRange)
            : indexBuffer(indexBuffer), type(type), mat(mat), geom(geom),
              indexOffset(indexOffset), drawRange(drawRange) {
#ifdef OE_SAFE
            unsigned int size = indexBuffer->GetSize();
            if (indexOffset > size)
                throw IndexOutOfBounds(indexOffset, 0, size);
            if (indexOffset + drawRange > size)
                throw IndexOutOfBounds(indexOffset + drawRange, 0, size);
#endif
        }
Exemple #2
0
int Map::GetTileAtPosition(uint x, uint y)
{
    if(x >= width || y >= height)
        throw IndexOutOfBounds();

    return map[x][y];
}
Exemple #3
0
size_t Matrix<T,rank>::size(int dim) const {
	if(dim < 0 || dim >= rank) throw IndexOutOfBounds("Dimension out of bounds");
	return this->_size[dim];
}
T& ArrayVector<T>::at(int i) throw (IndexOutOfBounds) {
  if (i < 0 || i >= size())
    throw IndexOutOfBounds("Illegal index in function at()");
  return A[i];
}
Exemple #5
0
A& Array2d<A>::operator()(size_t ix, size_t iy) {
	//if(x < 0 || y < 0) throw "Index out of bounds";
	if(ix >= this->_len[0] || iy >= this->_len[1])
		throw IndexOutOfBounds("Index out of bounds");
	return this->_data[this->_len[1] * iy + ix];
}
Exemple #6
0
void Array2d<A>::set(size_t ix, size_t iy, const A &value) {
	//if(x < 0 || y < 0) throw "Index out of bounds";
	if(ix >= this->_len[0] || iy >= this->_len[1])
		throw IndexOutOfBounds("Index out of bounds");
	this->_data[this->_len[1] * iy + ix] = value;
}
Exemple #7
0
void Array1d<A>::set(size_t index, const A &value) {
	// if(index < 0) throw "Index below range";
	if(index >= this->_size) throw IndexOutOfBounds("Index out of range");
	this->_data[index] = value;
}
Exemple #8
0
A Array1d<A>::get(size_t index) const {
	// if(index < 0) throw "Index below range";
	if(index >= this->_size) throw IndexOutOfBounds("Index out of range");
	return this->_data[index];
}
Exemple #9
0
A& Array1d<A>::operator()(size_t index) {
	// if(index < 0) throw "Index below range";
	if(index >= this->_size) throw IndexOutOfBounds("Index out of range");
	return this->_data[index];
}
Exemple #10
0
 void set(Owner o, std::size_t row, std::size_t col) {
   if (row >= nRows || col >= nCols) { throw IndexOutOfBounds(); }
   array[row * nCols + col] = o;
 }