default mesh collider are generated by default mesh, add camera info serialization, using error info instead of assert to process missing filepath when deserializing scene, move cullface into internal renderer api, fixed dynamic vertex buffer bug
This commit is contained in:
@ -9,8 +9,8 @@ namespace Prism
|
||||
public Vec3 Rotation;
|
||||
public Vec3 Scale;
|
||||
|
||||
public Vec3 Up;
|
||||
public Vec3 Right;
|
||||
public Vec3 Forward;
|
||||
public Vec3 Up { get; }
|
||||
public Vec3 Right { get; }
|
||||
public Vec3 Forward { get; }
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,8 @@ namespace Prism
|
||||
public float X;
|
||||
public float Y;
|
||||
|
||||
|
||||
public static Vec2 Zero = new Vec2(0.0f, 0.0f);
|
||||
public Vec2(float scalar)
|
||||
{
|
||||
X = Y = scalar;
|
||||
@ -39,12 +41,34 @@ namespace Prism
|
||||
return (float)Math.Sqrt(X * X + Y * Y);
|
||||
}
|
||||
|
||||
public Vec2 SafeNormalized()
|
||||
{
|
||||
float length = Length();
|
||||
if (length > float.Epsilon)
|
||||
{
|
||||
return new Vec2(X / length, Y / length);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Zero;
|
||||
}
|
||||
}
|
||||
public Vec2 Normalized()
|
||||
{
|
||||
float length = Length();
|
||||
return new Vec2(X / length, Y / length);
|
||||
}
|
||||
|
||||
public void SafeNormalize()
|
||||
{
|
||||
float length = Length();
|
||||
if (length > float.Epsilon)
|
||||
{
|
||||
X = X / length;
|
||||
Y = Y / length;
|
||||
}
|
||||
}
|
||||
|
||||
public void Normalize()
|
||||
{
|
||||
float length = Length();
|
||||
|
||||
@ -73,15 +73,25 @@ namespace Prism
|
||||
public Vec3 Normalized()
|
||||
{
|
||||
float length = Length();
|
||||
return new Vec3(X / length, Y / length, Z / length);
|
||||
if (length > float.Epsilon)
|
||||
{
|
||||
return new Vec3(X / length, Y / length, Z / length);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void Normalize()
|
||||
{
|
||||
float length = Length();
|
||||
X = X / length;
|
||||
Y = Y / length;
|
||||
Z = Z / length;
|
||||
if (length > float.Epsilon)
|
||||
{
|
||||
X = X / length;
|
||||
Y = Y / length;
|
||||
Z = Z / length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user