public Intersection(Intersectable intersectsWith, Ray ray, Vector3 surfaceNormal, Vector3 location, float distance, Material material) { IntersectsWith = intersectsWith; Ray = ray; SurfaceNormal = surfaceNormal; Location = location; Distance = distance; Material = material; }
public static Ray CreateFromTwoPoints(Vector3 origin, Vector3 target, Intersectable originalPrimitive) { var dir = target - origin; return(new Ray(origin, dir, Constants.MaxRayBounces, originalPrimitive) { T = dir.LengthFast }); }
public override float?intersects(Ray ray) { //return Intersection.intersects(ray, resourceBlocks.Keys); Intersectable intersected = Intersection.getNearestIntersectableAlongRay(ray, stockpiles); if (intersected != null) { return(intersected.intersects(ray)); } return(null); }
public static bool DoesIntersect(Ray ray, IEnumerable<Intersectable> intersectables, Intersectable ignore = null) { foreach (var obj in intersectables) { //if (obj is DebugSphere) //{ // continue; //} Intersection intersection; if (obj != ignore && obj.Intersect(ray, out intersection))// && !ReferenceEquals(ray.OriginPrimitive, obj)) { return true; } } return false; }
public new HitRecord Intersect(Ray ray) { //Transform ray to object coordinate system Ray transfRay = RayTransformer.TransformRayToObject(ray, InvTransformationMatrix); HitRecord hit = Intersectable.Intersect(transfRay); if (hit != null) { if (Material != null) { hit.Material = Material; } //Transform HitRecrod back to world coordinate system RayTransformer.TransformHitToWorld(hit, TransformationMatrix, TransposedTransformationMatrix); } return(hit); }
public static float?intersects(Ray ray, IEnumerable <Intersectable> intersectables) { float? minDist = float.MaxValue; Intersectable result = null; foreach (Intersectable site in intersectables) { float?thisDist = site.intersects(ray); if (thisDist.HasValue) { if (minDist > thisDist) { minDist = thisDist; result = site; } } } return(minDist); }
public static bool DoesIntersect(Ray ray, IEnumerable <Intersectable> intersectables, Intersectable ignore = null) { foreach (var obj in intersectables) { //if (obj is DebugSphere) //{ // continue; //} Intersection intersection; if (obj != ignore && obj.Intersect(ray, out intersection))// && !ReferenceEquals(ray.OriginPrimitive, obj)) { return(true); } } return(false); }
public Ray(Vector3 origin, Vector3 direction, int bouncesLeft, Intersectable originPrimitive, Material medium) : this(origin, direction, bouncesLeft) { OriginPrimitive = originPrimitive; Medium = medium; }
public Ray(Vector3 origin, Vector3 direction, int bouncesLeft, Intersectable originPrimitive) : this(origin, direction, bouncesLeft) { OriginPrimitive = originPrimitive; }
public int GetNumberOfComponents() { return(Intersectable.GetNumberOfComponents()); }
public new Vector3 GetSamplePoint(LightSample sample) { return(Intersectable.GetSamplePoint(sample)); }
public override void BuildBoundingBox() { Intersectable.BuildBoundingBox(); }
public Intersection(Intersectable intersectsWith, Ray ray, Vector3 surfaceNormal, Vector3 location, float distance, Material material, bool insidePrimitive) : this(intersectsWith, ray, surfaceNormal, location, distance, material) { InsidePrimitive = insidePrimitive; }
public void Add(Intersectable intersectable) { _intersectables.Add(intersectable); }
public new float GetArea() { return(Intersectable.GetArea()); }