Skip to content

Commit

Permalink
Merge branch 'feature/ui-refreshment' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
NanoBob committed May 26, 2022
2 parents cee4919 + c13a592 commit 25b494a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions RenderWarePreviewer/Helpers/AssetHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void SetGtaPath(string path)

public Dff GetDff(string name)
{
if (this.img == null)
if (this.img == null || this.intImg == null)
throw new FileNotFoundException("No img file found");

var key = SanitizeName(name) + ".dff";
Expand All @@ -66,7 +66,7 @@ public Dff GetDff(string name)

public Txd GetTxd(string name)
{
if (this.img == null)
if (this.img == null || this.intImg == null)
throw new FileNotFoundException("No img file found");

var key = SanitizeName(name) + ".txd";
Expand Down
2 changes: 1 addition & 1 deletion RenderWarePreviewer/Helpers/MeshHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace RenderWarePreviewer.Helpers
{
public static class MeshHelper
{
private static Dictionary<string, MeshGeometry3D> pyramids = new();
private static readonly Dictionary<string, MeshGeometry3D> pyramids = new();

public static IEnumerable<GeometryModel3D> GetModels(
Dff dff,
Expand Down
13 changes: 8 additions & 5 deletions RenderWarePreviewer/Scenes/Scene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class Scene
private readonly Transform3DGroup transformGroup;
private readonly Transform3DGroup cameraTransformGroup;
private readonly Model3DGroup group;
private readonly AmbientLight light;
private readonly AmbientLight ambientLight;
private readonly DirectionalLight directionalLight;

private readonly Vector3D up = new Vector3D(0, 0, 1);
private readonly Vector3D right = new Vector3D(1, 0, 0);
Expand All @@ -26,11 +27,13 @@ public class Scene

public Scene()
{
this.light = new AmbientLight(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));
this.ambientLight = new AmbientLight(System.Windows.Media.Color.FromArgb(255, 100, 100, 100));
this.directionalLight = new DirectionalLight(System.Windows.Media.Color.FromArgb(255, 255, 255, 255), new Vector3D(0, -1, -1));
this.transformGroup = new();

this.group = new Model3DGroup();
this.group.Children.Add(light);
this.group.Children.Add(ambientLight);
this.group.Children.Add(directionalLight);
this.group.Transform = this.transformGroup;

this.visual = new ModelVisual3D();
Expand All @@ -56,7 +59,8 @@ public Scene()
public void Clear()
{
this.group.Children.Clear();
this.group.Children.Add(light);
this.group.Children.Add(ambientLight);
this.group.Children.Add(directionalLight);
}

public void Add(GeometryModel3D model, Vector3D position, Vector3D rotation)
Expand Down Expand Up @@ -100,7 +104,6 @@ public void RotateWorld(float angle)
public void ZoomCamera(float value)
{
this.SetCameraPosition(this.CameraPosition + this.CameraForward * -value);
//this.SetCameraPosition(new Vector3((float)this.camera.Position.X, (float)this.camera.Position.Y + value, (float)this.camera.Position.Z + value));
}

public void SetCameraPosition(Vector3 position)
Expand Down
5 changes: 3 additions & 2 deletions RenderWarePreviewer/Scenes/SceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ public class SceneManager
{
private readonly Scene scene;
private readonly AssetHelper assetHelper;
private readonly string backgroundDffName = "cj_changing_room";
private readonly string backgroundTxdName = "CJ_CHANGE_ROOM";

private const string backgroundDffName = "cj_changing_room";
private const string backgroundTxdName = "CJ_CHANGE_ROOM";

private Vector3 cameraRotation = new Vector3(180, 180, 0);

Expand Down

0 comments on commit 25b494a

Please sign in to comment.