public bool Scatter(Ray rayIn, HitRecord record, ref Vec3 attenuation, ref Ray scatteredRay, Random random) { var bounceDirection = record.Normal + GeometrySampler.RandomPointInUnitSphere(random); scatteredRay = new Ray(record.Point, bounceDirection); attenuation = this.Albedo.Value(0, 0, record.Point); return(true); }
public Ray GetRay(int x, int y, Random random) { float u = (float)(x + random.NextDouble()) / this.columns; float v = (float)(y + random.NextDouble()) / this.rows; var randomDiskPoint = this.lensRadius * GeometrySampler.RandomPointInUnitDisk(random); var originOffset = this.u * randomDiskPoint.X + this.v * randomDiskPoint.Y; return(new Ray(this.Origin + originOffset, this.LowerLeftCorner + u * this.Horizontal + v * this.Vertical - this.Origin - originOffset)); }
public bool Scatter(Ray rayIn, HitRecord record, ref Vec3 attenuation, ref Ray scatteredRay, Random random) { var reflectedDirection = Vec3.Reflect(rayIn.Direction.Normalized, record.Normal); var fuzzyDirection = reflectedDirection + this.Fuzz * GeometrySampler.RandomPointInUnitSphere(random); scatteredRay = new Ray(record.Point, fuzzyDirection); attenuation = this.Albedo; return(scatteredRay.Direction.Dot(record.Normal) > 0); }
public BeamSpellEffect(ParticleEffect effect, GeometrySampler sampler) { this.effect = effect; this.sampler = sampler; emitter = effect.CreateCustomEmitter(1 / 100f, p => { p.StartPosition = seeder.NextFloat(0, 0.3f) * new Vector3(sampler.RandomPointOnCircle(), 0); p.Color = new Color4(1, 0, 0); p.Size = 0.1f; p.StartVelocity = new Vector3(0, 0, seeder.NextFloat(-1, -1)) * 50; p.Duration = 1f; }); }
public BurstSpellEffect(ParticleEffect effect) { this.effect = effect; sampler = new GeometrySampler(seeder); emitter = effect.CreateCustomEmitter(1 / 100f, p => { p.Color = new Color4(1, 0, 0); p.Size = 0.1f; p.StartVelocity = new Vector3(seeder.NextFloat(-1, 1) * 2, seeder.NextFloat(-1, 1) * 0.7f, seeder.NextFloat(-4, -5)); p.Duration = 1f; }); }
public ImpactSpellEffect(ParticleEffect effect, GeometrySampler sampler) { this.effect = effect; this.sampler = sampler; effect.Gravity = new Vector3(0, -10, 0); /*emitter = effect.CreateCustomEmitter(1 / 100f, p => * { * p.StartPosition = new Vector3(0, 0, 0); * p.Color = new Color4(1, 0, 0); * p.Size = 0.1f; * p.StartVelocity = sampler.RandomPointOnSphere()*5; * p.Duration = 3f; * });*/ }
public GeometrySamplerTest(IRenderingTester test, Seeder seeder) { this.test = test; this.seeder = seeder; s = new GeometrySampler(seeder); }
public SpellCastingEffectsTest(IRenderingTester r, GeometrySampler sampler) { this.r = r; this.sampler = sampler; }
public ManualIoCTestLoader() { sampler = new GeometrySampler(seeder); renderingTester = new IRenderingTester(EngineFactory.CreateEngine(), new IActionScheduler(), new ParticlesBoxRenderer()); }