mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Transitioned from VectorX to floatX
And some trying to update Rigidbody when transform changes
This commit is contained in:
@@ -113,25 +113,25 @@ class MaterialAssetPropertiesEditor : AssetPropertiesEditor
|
||||
|
||||
if (variable.Columns == 3)
|
||||
{
|
||||
material.GetVariable<Vector3>(variable.Name, var value);
|
||||
material.GetVariable<float3>(variable.Name, var value);
|
||||
|
||||
value = (Vector3)ColorRGB.LinearToSRGB((ColorRGB)value);
|
||||
value = (float3)ColorRGB.LinearToSRGB((ColorRGB)value);
|
||||
|
||||
if (ImGui.ColorEdit3(displayName.Ptr, *(float[3]*)&value))
|
||||
{
|
||||
value = (Vector3)ColorRGB.SRgbToLinear((ColorRGB)value);
|
||||
value = (float3)ColorRGB.SRgbToLinear((ColorRGB)value);
|
||||
material.SetVariable(variable.Name, value);
|
||||
}
|
||||
}
|
||||
else if (variable.Columns == 4)
|
||||
{
|
||||
material.GetVariable<Vector4>(variable.Name, var value);
|
||||
material.GetVariable<float4>(variable.Name, var value);
|
||||
|
||||
value = (Vector4)ColorRGBA.LinearToSRGB((ColorRGBA)value);
|
||||
value = (float4)ColorRGBA.LinearToSRGB((ColorRGBA)value);
|
||||
|
||||
if (ImGui.ColorEdit4(displayName.Ptr, *(float[4]*)&value))
|
||||
{
|
||||
value = (Vector4)ColorRGBA.SRgbToLinear((ColorRGBA)value);
|
||||
value = (float4)ColorRGBA.SRgbToLinear((ColorRGBA)value);
|
||||
material.SetVariable(variable.Name, value);
|
||||
}
|
||||
}
|
||||
@@ -154,28 +154,28 @@ class MaterialAssetPropertiesEditor : AssetPropertiesEditor
|
||||
if (ImGui.EditVector<1>(displayName, ref *(float[1]*)&value, .(), 0.1f, 100.0f, minV, maxV))
|
||||
material.SetVariable(variable.Name, value);
|
||||
case 2:
|
||||
material.GetVariable<Vector2>(variable.Name, var value);
|
||||
material.GetVariable<float2>(variable.Name, var value);
|
||||
|
||||
Vector2 minV = hasMin ? min.Get<Vector2>() : .(float.MinValue);
|
||||
Vector2 maxV = hasMax ? max.Get<Vector2>() : .(float.MaxValue);
|
||||
float2 minV = hasMin ? min.Get<float2>() : (float2)float.MinValue;
|
||||
float2 maxV = hasMax ? max.Get<float2>() : (float2)float.MaxValue;
|
||||
|
||||
if (ImGui.EditVector2(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV))
|
||||
if (ImGui.Editfloat2(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV))
|
||||
material.SetVariable(variable.Name, value);
|
||||
case 3:
|
||||
material.GetVariable<Vector3>(variable.Name, var value);
|
||||
material.GetVariable<float3>(variable.Name, var value);
|
||||
|
||||
Vector3 minV = hasMin ? min.Get<Vector3>() : .(float.MinValue);
|
||||
Vector3 maxV = hasMax ? max.Get<Vector3>() : .(float.MaxValue);
|
||||
float3 minV = hasMin ? min.Get<float3>() : (float3)float.MinValue;
|
||||
float3 maxV = hasMax ? max.Get<float3>() : (float3)float.MaxValue;
|
||||
|
||||
if (ImGui.EditVector3(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV))
|
||||
if (ImGui.Editfloat3(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV))
|
||||
material.SetVariable(variable.Name, value);
|
||||
case 4:
|
||||
material.GetVariable<Vector4>(variable.Name, var value);
|
||||
material.GetVariable<float4>(variable.Name, var value);
|
||||
|
||||
Vector4 minV = hasMin ? min.Get<Vector4>() : .(float.MinValue);
|
||||
Vector4 maxV = hasMax ? max.Get<Vector4>() : .(float.MaxValue);
|
||||
float4 minV = hasMin ? min.Get<float4>() : (float4)float.MinValue;
|
||||
float4 maxV = hasMax ? max.Get<float4>() : (float4)float.MaxValue;
|
||||
|
||||
if (ImGui.EditVector4(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV))
|
||||
if (ImGui.Editfloat4(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV))
|
||||
material.SetVariable(variable.Name, value);
|
||||
}
|
||||
}
|
||||
@@ -199,9 +199,9 @@ class MaterialAssetLoaderConfig : AssetLoaderConfig
|
||||
public enum VariableValue
|
||||
{
|
||||
case Float(float Value);
|
||||
case Float2(Vector2 Value);
|
||||
case Float3(Vector3 Value);
|
||||
case Float4(Vector4 Value);
|
||||
case Float2(float2 Value);
|
||||
case Float3(float3 Value);
|
||||
case Float4(float4 Value);
|
||||
case Int(int Value);
|
||||
case Int2(Int2 Value);
|
||||
case Int3(Int3 Value);
|
||||
@@ -450,13 +450,13 @@ class MaterialAssetLoader : IAssetLoader, IAssetSaver //, IReloadingAssetLoader
|
||||
material.GetVariable<float>(variable.Name, let value);
|
||||
variableValue = .Float(value);
|
||||
case 2:
|
||||
material.GetVariable<Vector2>(variable.Name, let value);
|
||||
material.GetVariable<float2>(variable.Name, let value);
|
||||
variableValue = .Float2(value);
|
||||
case 3:
|
||||
material.GetVariable<Vector3>(variable.Name, let value);
|
||||
material.GetVariable<float3>(variable.Name, let value);
|
||||
variableValue = .Float3(value);
|
||||
case 4:
|
||||
material.GetVariable<Vector4>(variable.Name, let value);
|
||||
material.GetVariable<float4>(variable.Name, let value);
|
||||
variableValue = .Float4(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,16 +160,32 @@ namespace GlitchyEditor.EditWindows
|
||||
|
||||
textWidth += ImGui.GetStyle().FramePadding.x * 3.0f;
|
||||
|
||||
Vector3 position = transform.Position;
|
||||
if (ImGui.EditVector3("Position", ref position, .Zero, 0.1f, textWidth))
|
||||
float3 position = transform.Position;
|
||||
if (ImGui.Editfloat3("Position", ref position, .Zero, 0.1f, textWidth))
|
||||
{
|
||||
transform.Position = position;
|
||||
|
||||
Vector3 rotationEuler = MathHelper.ToDegrees(transform.EditorRotationEuler);
|
||||
if (ImGui.EditVector3("Rotation", ref rotationEuler, .Zero, 0.1f, textWidth))
|
||||
// if necessary reposition Rigidbody2D
|
||||
if (entity.TryGetComponent<Rigidbody2DComponent>(let rigidbody2D))
|
||||
{
|
||||
rigidbody2D.SetPosition(position.XY);
|
||||
}
|
||||
}
|
||||
|
||||
float3 rotationEuler = MathHelper.ToDegrees(transform.EditorRotationEuler);
|
||||
if (ImGui.Editfloat3("Rotation", ref rotationEuler, .Zero, 0.1f, textWidth))
|
||||
{
|
||||
transform.EditorRotationEuler = MathHelper.ToRadians(rotationEuler);
|
||||
|
||||
// if necessary reposition Rigidbody2D
|
||||
if (entity.TryGetComponent<Rigidbody2DComponent>(let rigidbody2D))
|
||||
{
|
||||
rigidbody2D.SetAngle(rotationEuler.Z);
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 scale = transform.Scale;
|
||||
if (ImGui.EditVector3("Scale", ref scale, .One, 0.1f, textWidth))
|
||||
float3 scale = transform.Scale;
|
||||
if (ImGui.Editfloat3("Scale", ref scale, .One, 0.1f, textWidth))
|
||||
transform.Scale = scale;
|
||||
}
|
||||
|
||||
@@ -375,12 +391,12 @@ namespace GlitchyEditor.EditWindows
|
||||
textWidth += ImGui.GetStyle().FramePadding.x * 3.0f;
|
||||
|
||||
|
||||
Vector2 offset = boxCollider.Offset;
|
||||
if (ImGui.EditVector2("Offset", ref offset, .Zero, 0.1f, textWidth))
|
||||
float2 offset = boxCollider.Offset;
|
||||
if (ImGui.Editfloat2("Offset", ref offset, .Zero, 0.1f, textWidth))
|
||||
boxCollider.Offset = offset;
|
||||
|
||||
Vector2 size = boxCollider.Size;
|
||||
if (ImGui.EditVector2("Size", ref size, .Zero, 0.1f, textWidth))
|
||||
float2 size = boxCollider.Size;
|
||||
if (ImGui.Editfloat2("Size", ref size, .Zero, 0.1f, textWidth))
|
||||
boxCollider.Size = size;
|
||||
|
||||
float density = boxCollider.Density;
|
||||
@@ -406,8 +422,8 @@ namespace GlitchyEditor.EditWindows
|
||||
textWidth += ImGui.GetStyle().FramePadding.x * 3.0f;
|
||||
|
||||
|
||||
Vector2 offset = circleCollider.Offset;
|
||||
if (ImGui.EditVector2("Offset", ref offset, .Zero, 0.1f, textWidth))
|
||||
float2 offset = circleCollider.Offset;
|
||||
if (ImGui.Editfloat2("Offset", ref offset, .Zero, 0.1f, textWidth))
|
||||
circleCollider.Offset = offset;
|
||||
|
||||
float radius = circleCollider.Radius;
|
||||
@@ -542,17 +558,17 @@ namespace GlitchyEditor.EditWindows
|
||||
if (ImGui.DragScalar(fieldName.ToScopeCStr!(), .Float, &value))
|
||||
SetFieldValue(scriptInstance, scriptField, value);
|
||||
|
||||
case .Vector2:
|
||||
GetFieldValue<Vector2>(scriptInstance, scriptField, var value);
|
||||
if (ImGui.EditVector2(fieldName, ref value))
|
||||
case .float2:
|
||||
GetFieldValue<float2>(scriptInstance, scriptField, var value);
|
||||
if (ImGui.Editfloat2(fieldName, ref value))
|
||||
SetFieldValue(scriptInstance, scriptField, value);
|
||||
case .Vector3:
|
||||
GetFieldValue<Vector3>(scriptInstance, scriptField, var value);
|
||||
if (ImGui.EditVector3(fieldName, ref value))
|
||||
case .float3:
|
||||
GetFieldValue<float3>(scriptInstance, scriptField, var value);
|
||||
if (ImGui.Editfloat3(fieldName, ref value))
|
||||
SetFieldValue(scriptInstance, scriptField, value);
|
||||
case .Vector4:
|
||||
GetFieldValue<Vector4>(scriptInstance, scriptField, var value);
|
||||
if (ImGui.EditVector4(fieldName, ref value))
|
||||
case .float4:
|
||||
GetFieldValue<float4>(scriptInstance, scriptField, var value);
|
||||
if (ImGui.Editfloat4(fieldName, ref value))
|
||||
SetFieldValue(scriptInstance, scriptField, value);
|
||||
|
||||
case .Double:
|
||||
|
||||
@@ -132,9 +132,9 @@ namespace GlitchyEditor.EditWindows
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector2 DirectoryItemSize = .(110, 110);
|
||||
private static float2 DirectoryItemSize = .(110, 110);
|
||||
|
||||
const Vector2 padding = .(24, 24);
|
||||
const float2 padding = .(24, 24);
|
||||
|
||||
/// Renders the contents of _currentDirectory.
|
||||
private void DrawCurrentDirectory()
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace GlitchyEditor.EditWindows
|
||||
public uint32 SelectedEntityId {get; private set; }
|
||||
public bool SelectionChanged { get; private set; }
|
||||
|
||||
public Vector2 ViewportSize => (Vector2)_oldViewportSize;
|
||||
public float2 ViewportSize => (float2)_oldViewportSize;
|
||||
// Occurs when the viewport is resized.
|
||||
public Event<EventHandler<Vector2>> ViewportSizeChanged ~ _.Dispose();
|
||||
public Event<EventHandler<float2>> ViewportSizeChanged ~ _.Dispose();
|
||||
// Occurs when an entity was clicked.
|
||||
public Event<EventHandler<uint32>> EntityClicked ~ _.Dispose();
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace GlitchyEditor.EditWindows
|
||||
|
||||
if(_oldViewportSize != viewportSize)
|
||||
{
|
||||
ViewportSizeChanged.Invoke(this, (Vector2)viewportSize);
|
||||
ViewportSizeChanged.Invoke(this, (float2)viewportSize);
|
||||
_viewPortChanged = true;
|
||||
_oldViewportSize = viewportSize;
|
||||
}
|
||||
@@ -154,14 +154,14 @@ namespace GlitchyEditor.EditWindows
|
||||
{
|
||||
_wrappedCursor = false;
|
||||
|
||||
let mousePos = (Vector2)ImGui.GetMousePos();
|
||||
let winPos = (Vector2)ImGui.GetWindowPos();
|
||||
let regionMin = winPos + (Vector2)ImGui.GetWindowContentRegionMin();
|
||||
let regionMax = winPos + (Vector2)ImGui.GetWindowContentRegionMax();
|
||||
let mousePos = (float2)ImGui.GetMousePos();
|
||||
let winPos = (float2)ImGui.GetWindowPos();
|
||||
let regionMin = winPos + (float2)ImGui.GetWindowContentRegionMin();
|
||||
let regionMax = winPos + (float2)ImGui.GetWindowContentRegionMax();
|
||||
|
||||
ImGui.DrawRect((.)regionMin, (.)regionMax, .(0, 255, 0));
|
||||
|
||||
Vector2 newMousePos = mousePos;
|
||||
float2 newMousePos = mousePos;
|
||||
|
||||
if (mousePos.X < regionMin.X + 1)
|
||||
{
|
||||
@@ -181,7 +181,7 @@ namespace GlitchyEditor.EditWindows
|
||||
newMousePos.Y = regionMin.Y + 10;
|
||||
}
|
||||
|
||||
if (newMousePos != mousePos)
|
||||
if (any(newMousePos != mousePos))
|
||||
{
|
||||
Input.SetMousePosition((Int2)newMousePos);
|
||||
// After wrapping the cursor the the other side, the camera controller must not compare the positions,
|
||||
@@ -195,7 +195,7 @@ namespace GlitchyEditor.EditWindows
|
||||
/// If the user clicks, the entity beneath the cursor will be selected.
|
||||
private void MousePicking(ImGui.Vec2 viewportSize, bool gizmoUsed)
|
||||
{
|
||||
Vector2 relativeMouse = (Vector2)ImGui.GetMousePos() - (Vector2)ImGui.GetItemRectMin();
|
||||
float2 relativeMouse = (float2)ImGui.GetMousePos() - (float2)ImGui.GetItemRectMin();
|
||||
|
||||
int rtWidth = _editor.EditorSceneRenderer.CompositeTarget.Width;
|
||||
int rtHeight = _editor.EditorSceneRenderer.CompositeTarget.Height;
|
||||
@@ -316,9 +316,9 @@ namespace GlitchyEditor.EditWindows
|
||||
parentView = parentTransformCmp.WorldTransform.Invert();
|
||||
}
|
||||
|
||||
Vector3 snap = .(_snap);
|
||||
float3 snap = (float3)_snap;
|
||||
if (_gizmoType.HasFlag(.ROTATE))
|
||||
snap = .(_angleSnap);
|
||||
snap = (float3)_angleSnap;
|
||||
|
||||
if (ImGuizmo.Manipulate((.)&view, (.)&projection, _gizmoType, _gizmoMode, (.)&worldTransform, null, _doSnap ? (.)&snap : null))
|
||||
{
|
||||
|
||||
@@ -20,9 +20,9 @@ namespace GlitchyEditor.EditWindows
|
||||
|
||||
private RenderTargetGroup _renderTarget ~ _?.ReleaseRef();
|
||||
|
||||
public Vector2 ViewportSize => (Vector2)_oldViewportSize;
|
||||
public float2 ViewportSize => (float2)_oldViewportSize;
|
||||
// Occurs when the viewport is resized.
|
||||
public Event<EventHandler<Vector2>> ViewportSizeChanged ~ _.Dispose();
|
||||
public Event<EventHandler<float2>> ViewportSizeChanged ~ _.Dispose();
|
||||
// Occurs when an entity was clicked.
|
||||
public Event<EventHandler<uint32>> EntityClicked ~ _.Dispose();
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace GlitchyEditor.EditWindows
|
||||
|
||||
if(_oldViewportSize != viewportSize)
|
||||
{
|
||||
ViewportSizeChanged.Invoke(this, (Vector2)viewportSize);
|
||||
ViewportSizeChanged.Invoke(this, (float2)viewportSize);
|
||||
_viewPortChanged = true;
|
||||
_oldViewportSize = viewportSize;
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace GlitchyEditor
|
||||
set => _texture.Get().SamplerState = value;
|
||||
}
|
||||
|
||||
public this(String texturePath, Vector2 iconSize)
|
||||
public this(String texturePath, float2 iconSize)
|
||||
{
|
||||
_texture = Content.LoadAsset(texturePath, null, true);
|
||||
|
||||
Vector2 pen = .();
|
||||
float2 pen = .();
|
||||
|
||||
DirectionalLight = GetNextGridTexture(ref pen, iconSize);
|
||||
Camera = GetNextGridTexture(ref pen, iconSize);
|
||||
@@ -41,7 +41,7 @@ namespace GlitchyEditor
|
||||
Pause = GetNextGridTexture(ref pen, iconSize);
|
||||
}
|
||||
|
||||
private SubTexture2D GetNextGridTexture(ref Vector2 pen, Vector2 iconSize)
|
||||
private SubTexture2D GetNextGridTexture(ref float2 pen, float2 iconSize)
|
||||
{
|
||||
SubTexture2D subTexture = .CreateFromGrid(_texture, pen, iconSize);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace GlitchyEditor
|
||||
_gameSceneRenderer = new SceneRenderer();
|
||||
_editorSceneRenderer = new SceneRenderer();
|
||||
|
||||
_camera = EditorCamera(Vector3(3.5f, 1.25f, 2.75f), Quaternion.FromEulerAngles(MathHelper.ToRadians(40), MathHelper.ToRadians(25), 0), MathHelper.ToRadians(75), 0.1f, 1);
|
||||
_camera = EditorCamera(float3(3.5f, 1.25f, 2.75f), Quaternion.FromEulerAngles(MathHelper.ToRadians(40), MathHelper.ToRadians(25), 0), MathHelper.ToRadians(75), 0.1f, 1);
|
||||
_camera.RenderTarget = _cameraTarget;
|
||||
|
||||
InitEditor();
|
||||
@@ -256,14 +256,14 @@ namespace GlitchyEditor
|
||||
|
||||
Matrix Billboard(Matrix transform)
|
||||
{
|
||||
Vector3 worldPos = transform.Translation;
|
||||
float3 worldPos = transform.Translation;
|
||||
|
||||
return Matrix.Translation(worldPos) * billboard;
|
||||
}
|
||||
|
||||
float CalculateAlpha(Vector3 pos)
|
||||
float CalculateAlpha(float3 pos)
|
||||
{
|
||||
return Math.Clamp(1.5f - Vector3.Distance(_editor.CurrentCamera.Position, pos) / 50, 0, 1);
|
||||
return Math.Clamp(1.5f - distance(_editor.CurrentCamera.Position, pos) / 50, 0, 1);
|
||||
}
|
||||
|
||||
for (var (entity, transform, camera) in _activeScene.GetEntities<TransformComponent, CameraComponent>())
|
||||
@@ -288,7 +288,7 @@ namespace GlitchyEditor
|
||||
|
||||
for (float angle = 0; angle < MathHelper.TwoPi; angle += MathHelper.TwoPi / 5.0f)
|
||||
{
|
||||
Vector2 pos = MathHelper.CirclePoint(angle, 0.5f);
|
||||
float2 pos = MathHelper.CirclePoint(angle, 0.5f);
|
||||
|
||||
Renderer.DrawRay(.(pos, 0), .(pos, 20), .White, transform.WorldTransform);
|
||||
}
|
||||
@@ -540,8 +540,8 @@ namespace GlitchyEditor
|
||||
{
|
||||
let cameraEntity = newScene.CreateEntity("Camera");
|
||||
let transform = cameraEntity.Transform;
|
||||
transform.Position = Vector3(0, 2, -5);
|
||||
transform.RotationEuler = Vector3(0, MathHelper.ToRadians(25), 0);
|
||||
transform.Position = float3(0, 2, -5);
|
||||
transform.RotationEuler = float3(0, MathHelper.ToRadians(25), 0);
|
||||
|
||||
let camera = cameraEntity.AddComponent<CameraComponent>();
|
||||
camera.Primary = true;
|
||||
@@ -717,14 +717,14 @@ namespace GlitchyEditor
|
||||
return false;
|
||||
}
|
||||
|
||||
private void EditorViewportSizeChanged(Object sender, Vector2 viewportSize)
|
||||
private void EditorViewportSizeChanged(Object sender, float2 viewportSize)
|
||||
{
|
||||
if(viewportSize.X <= 0 || viewportSize.Y <= 0)
|
||||
return;
|
||||
|
||||
uint32 sizeX = (uint32)viewportSize.X;
|
||||
uint32 sizeY = (uint32)viewportSize.Y;
|
||||
|
||||
if(sizeX == 0 || sizeY == 0)
|
||||
return;
|
||||
|
||||
_editorViewportTarget.Resize(sizeX, sizeY);
|
||||
_cameraTarget.Resize(sizeX, sizeY);
|
||||
|
||||
@@ -733,7 +733,7 @@ namespace GlitchyEditor
|
||||
_editorSceneRenderer.OnViewportResize(sizeX, sizeY);
|
||||
}
|
||||
|
||||
private void GameViewportSizeChanged(Object sender, Vector2 viewportSize)
|
||||
private void GameViewportSizeChanged(Object sender, float2 viewportSize)
|
||||
{
|
||||
if(viewportSize.X <= 0 || viewportSize.Y <= 0)
|
||||
return;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace GlitchyEditor
|
||||
_samplerPoint = SamplerStateManager.GetSampler(desc);
|
||||
}
|
||||
|
||||
Vector2 _position;
|
||||
float2 _position;
|
||||
|
||||
bool _moving;
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace GlitchyEditor
|
||||
{
|
||||
var windowPos = ImGui.GetWindowPos();
|
||||
var mousePos = ImGui.GetIO().MousePos;
|
||||
Vector2 mouseInWindow = .(mousePos.x - windowPos.x, mousePos.y - windowPos.y);
|
||||
float2 mouseInWindow = .(mousePos.x - windowPos.x, mousePos.y - windowPos.y);
|
||||
|
||||
bool windowHovered = ImGui.IsWindowHovered();
|
||||
|
||||
@@ -181,10 +181,10 @@ namespace GlitchyEditor
|
||||
_context.SetDepthStencilTarget(_depth);
|
||||
_context.BindRenderTargets();
|
||||
|
||||
Vector2 textureSize = Vector2(viewedTexture.Width, viewedTexture.Height);
|
||||
Vector2 zoomedTextureSize = textureSize * _zoom;
|
||||
float2 textureSize = float2(viewedTexture.Width, viewedTexture.Height);
|
||||
float2 zoomedTextureSize = textureSize * _zoom;
|
||||
|
||||
Vector2 targetSize = Vector2(_target.Width, _target.Height);
|
||||
float2 targetSize = float2(_target.Width, _target.Height);
|
||||
|
||||
_effect.Variables["ColorOffset"].SetData(_colorOffset);
|
||||
_effect.Variables["ColorScale"].SetData(_colorScale);
|
||||
@@ -204,19 +204,19 @@ namespace GlitchyEditor
|
||||
switch(_backgroundMode)
|
||||
{
|
||||
case .Black:
|
||||
Renderer2D.DrawQuadPivotCorner(Vector3(0, 0, 1), targetSize, 0, .Black);
|
||||
Renderer2D.DrawQuadPivotCorner(float3(0, 0, 1), targetSize, 0, .Black);
|
||||
case .White:
|
||||
Renderer2D.DrawQuadPivotCorner(Vector3(0, 0, 1), targetSize, 0, .White);
|
||||
Renderer2D.DrawQuadPivotCorner(float3(0, 0, 1), targetSize, 0, .White);
|
||||
case .Checkerboard:
|
||||
float quadSize = 50.0f;
|
||||
|
||||
Vector2 numQuads = (targetSize / 500f) * 10f;
|
||||
float2 numQuads = (targetSize / 500f) * 10f;
|
||||
|
||||
for(float x = 0; x < numQuads.X; x++)
|
||||
{
|
||||
for(float y = 0; y < numQuads.Y; y++)
|
||||
{
|
||||
Renderer2D.DrawQuadPivotCorner(Vector3(x * quadSize, -y * quadSize, 1), quadSize.XX, 0, ((x + y) % 2 == 0) ? .White : .Gray);
|
||||
Renderer2D.DrawQuadPivotCorner(float3(x * quadSize, -y * quadSize, 1), quadSize.XX, 0, ((x + y) % 2 == 0) ? .White : .Gray);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -236,7 +236,7 @@ namespace GlitchyEditor
|
||||
|
||||
Renderer2D.BeginScene(_camera, .SortByTexture, _effect);
|
||||
|
||||
Renderer2D.DrawQuad(Vector3(_position * .(1, -1), 0), zoomedTextureSize, 0, viewedTexture);
|
||||
Renderer2D.DrawQuad(float3(_position * .(1, -1), 0), zoomedTextureSize, 0, viewedTexture);
|
||||
|
||||
Renderer2D.EndScene();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user