Skip to content

Commit

Permalink
Merge pull request #72 from tomasz-herman/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
p-flis authored Jan 30, 2021
2 parents 1162c17 + 2ada090 commit 31734fc
Show file tree
Hide file tree
Showing 48 changed files with 31,524 additions and 4,587 deletions.
2 changes: 1 addition & 1 deletion RayTracer/Properties/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions RayTracer/Resources/Models/grass.dae

Large diffs are not rendered by default.

1,763 changes: 42 additions & 1,721 deletions RayTracer/Resources/Models/tank.dae

Large diffs are not rendered by default.

Binary file added RayTracer/Resources/Textures/moro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions RayTracer/Source/Cameras/LensCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class LensCamera : Camera
private Func<int, List<Vector2>> _sampling;
private int _samplesCount;

public bool AutoFocus { get; set; }
public bool AutoFocus { get; set; } = true;

public float LensRadius
{
Expand Down Expand Up @@ -60,7 +60,7 @@ public int SamplesCount
}
}

public LensCamera(Vector3 position, float lensRadius = 0.25f, float focusDistance = 5, int samplesCount = 10000,
public LensCamera(Vector3 position, float lensRadius = 0.2f, float focusDistance = 5, int samplesCount = 10000,
Func<int, List<Vector2>> sampling = null)
{
Position = position;
Expand Down
1 change: 1 addition & 0 deletions RayTracer/Source/Models/Cuboid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using RayTracing.Materials;
using RayTracing.Maths;
using RayTracing.RayTracing;
using Properties = RayTracer.Properties;

namespace RayTracing.Models
{
Expand Down
3 changes: 2 additions & 1 deletion RayTracer/Source/Models/CustomModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
using OpenTK;
using RayTracing.Maths;
using RayTracing.RayTracing;
using Properties = RayTracer.Properties;

namespace RayTracing.Models
{
public class CustomModel : Model
{
public Mesh Mesh
public new Mesh Mesh
{
get => base.Mesh;
set
Expand Down
1 change: 1 addition & 0 deletions RayTracer/Source/Models/Cylinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using OpenTK;
using RayTracing.Materials;
using RayTracing.Maths;
using Properties = RayTracer.Properties;

namespace RayTracing.Models
{
Expand Down
1 change: 1 addition & 0 deletions RayTracer/Source/Models/Plane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using OpenTK;
using RayTracing.Materials;
using RayTracing.Maths;
using Properties = RayTracer.Properties;

namespace RayTracing.Models
{
Expand Down
1 change: 1 addition & 0 deletions RayTracer/Source/Models/Rectangle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using RayTracing.Materials;
using RayTracing.Maths;
using RayTracing.RayTracing;
using Properties = RayTracer.Properties;

namespace RayTracing.Models
{
Expand Down
1 change: 1 addition & 0 deletions RayTracer/Source/Models/Sphere.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using OpenTK;
using RayTracing.Materials;
using RayTracing.Maths;
using Properties = RayTracer.Properties;

namespace RayTracing.Models
{
Expand Down
6 changes: 5 additions & 1 deletion RayTracer/Source/Renderer/RayTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ public RayTracer(int maxDepth, int samples, Func<int, List<Vector2>> sampling, i

public Color Shade(Ray ray, Scene scene, int depth)
{
if (depth == 0) return new Color();
if (depth == 0)
{
var ambient = scene.AmbientLight.Color;
return new Color(ambient.R, ambient.G, ambient.B);
}

HitInfo hitInfo = new HitInfo();

Expand Down
5 changes: 1 addition & 4 deletions RayTracer/Source/Renderer/SamplesRayTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ namespace RayTracing
{
public class SamplesRayTracer : IncrementalRayTracer
{
private readonly int _samplesRenderStep;

public SamplesRayTracer(int maxDepth, int samples, Func<int, List<Vector2>> sampling, int resolution,
int samplesRenderStep) : base(
maxDepth, samples, sampling, resolution, samplesRenderStep)
{
_samplesRenderStep = samplesRenderStep;
}

public override void Render(Scene scene, Camera camera)
Expand Down Expand Up @@ -71,7 +68,7 @@ public override void Render(Scene scene, Camera camera)
if (CancellationToken.IsCancellationRequested)
return;

if (k % _samplesRenderStep == 0 || k == Samples - 1)
if (k % SamplesRenderStep == 0 || k == Samples - 1)
{
var output = new Texture(image);
output.Process(c => (c / (k + 1)).Clamp());
Expand Down
20 changes: 20 additions & 0 deletions RayTracerApp/Forms/EditObjectForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 31734fc

Please sign in to comment.