#include <msp/time/units.h>
#include "animation.h"
#include "armature.h"
+#include "error.h"
#include "keyframe.h"
#include "pose.h"
Matrix Animation::Iterator::get_pose_matrix(unsigned link) const
{
if(!animation.armature)
- throw logic_error("Animation::Iterator::get_pose_matrix");
+ throw invalid_operation("Animation::Iterator::get_pose_matrix");
if(link>animation.armature->get_max_link_index())
throw out_of_range("Animation::Iterator::get_pose_matrix");
+#include <msp/core/maputils.h>
#include "armature.h"
using namespace std;
for(list<Link>::const_iterator i=links.begin(); i!=links.end(); ++i)
if(i->get_index()==index)
return *i;
- throw invalid_argument("Armature::get_link");
+ throw key_error(typeid(list<Link>));
}
const Armature::Link &Armature::get_link(const string &name) const
for(list<Link>::const_iterator i=links.begin(); i!=links.end(); ++i)
if(i->get_name()==name)
return *i;
- throw invalid_argument("Armature::get_link");
+ throw key_error(typeid(list<Link>));
}
unsigned Armature::get_max_link_index() const
void Bloom::set_radius(float r)
{
if(r<=0.0f)
- throw out_of_range("Bloom::set_radius");
+ throw invalid_argument("Bloom::set_radius");
int size = min(static_cast<int>(r*3.0f), 9);
blur_shdata_common.uniform("size", size);
void Bloom::set_strength(float s)
{
if(s<0.0f || s>1.0f)
- throw out_of_range("Bloom::set_strength");
+ throw invalid_argument("Bloom::set_strength");
combine_shdata.uniform("strength", s);
}
if(type==UNIFORM_BUFFER)
{
if(index>=get_n_uniform_buffer_bindings())
- throw out_of_range("Buffer::binding");
+ throw out_of_range("BufferRange::binding");
if(bound_uniform.size()<=index)
bound_uniform.resize(index+1);
return bound_uniform[index];
}
else
- throw invalid_argument("Buffer::binding");
+ throw invalid_argument("BufferRange::binding");
}
bool BufferRange::set_current(BufferType type, unsigned index, const BufferRange *buf)
void Object::set_mesh(unsigned i, const Mesh *m)
{
if(i>meshes.size())
- throw invalid_argument("Object::set_mesh");
+ throw out_of_range("Object::set_mesh");
if(i==meshes.size())
meshes.push_back(m);
void Object::Loader::mesh_inline_lod(unsigned l)
{
if(l>obj.meshes.size())
- throw invalid_argument("Object::Loader::mesh_inline_lod");
+ throw out_of_range("Object::Loader::mesh_inline_lod");
RefPtr<Mesh> msh = new Mesh;
load_sub(*msh);
void Pose::Loader::link(const string &n)
{
if(!obj.armature)
- error("Armature must be specified first");
+ throw logic_error("Armature must be specified first");
LinkLoader ldr(obj, obj.armature->get_link(n).get_index());
load_sub_with(ldr);
}
unsigned s = get_level_size(level);
if(s==0)
- throw invalid_argument("TextureCube::image");
+ throw out_of_range("TextureCube::image");
Bind _bind(this, true);
glTexImage2D(face, level, ifmt, s, s, 0, fmt, type, data);
bool TexUnit::set_texgen(unsigned i, const TexGen *gen)
{
if(i>=4)
- throw invalid_argument("TexUnit::set_texgen");
+ throw out_of_range("TexUnit::set_texgen");
bool result = (texgen[i]!=gen);
texgen[i] = gen;
return result;
const TexGen *TexUnit::get_texgen(unsigned i)
{
if(i>=4)
- throw invalid_argument("TexUnit::get_texgen");
+ throw out_of_range("TexUnit::get_texgen");
return texgen[i];
}
VertexFormat r = f;
unsigned char *c = r.data+r.data[0];
if((*c<TEXCOORD1 && i>0) || (*c<ATTRIB1 && i>=8) || i>=53)
- throw out_of_range("VertexFormat::operator,");
+ throw invalid_argument("VertexFormat::operator,");
*c += i*4;
return r;