mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
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:
@@ -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) {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user