Several performance improvements, mainly in loading and instancing scenes and resources.

A general speedup should be apparent, with even more peformance increase when compiling optimized.

WARNING: Tested and it seems to work, but if something breaks, please report.
This commit is contained in:
Juan Linietsky
2015-06-29 00:29:49 -03:00
parent 2b64f73b04
commit 95047562d7
62 changed files with 475 additions and 294 deletions

View File

@@ -878,6 +878,63 @@ bool Variant::is_zero() const {
return false;
}
bool Variant::is_one() const {
switch( type ) {
case NIL: {
return true;
} break;
// atomic types
case BOOL: {
return _data._bool==true;
} break;
case INT: {
return _data._int==1;
} break;
case REAL: {
return _data._real==1;
} break;
case VECTOR2: {
return *reinterpret_cast<const Vector2*>(_data._mem)==Vector2(1,1);
} break;
case RECT2: {
return *reinterpret_cast<const Rect2*>(_data._mem)==Rect2(1,1,1,1);
} break;
case VECTOR3: {
return *reinterpret_cast<const Vector3*>(_data._mem)==Vector3(1,1,1);
} break;
case PLANE: {
return *reinterpret_cast<const Plane*>(_data._mem)==Plane(1,1,1,1);
} break;
case COLOR: {
return *reinterpret_cast<const Color*>(_data._mem)==Color(1,1,1,1);
} break;
default: { return !is_zero(); }
}
return false;
}
void Variant::reference(const Variant& p_variant) {