Refactor shapes
This commit is contained in:
parent
eb39846b75
commit
006ab3c4e6
3 changed files with 203 additions and 256 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { vec2, vec3 } from 'gl-matrix';
|
||||
import { GameObject } from '../../../objects/game-object';
|
||||
import { ImmutableBoundingBox } from '../../../physics/containers/immutable-bounding-box';
|
||||
import { settings } from '../../settings';
|
||||
import { IDrawableDescriptor } from '../i-drawable-descriptor';
|
||||
import { ILight } from './i-light';
|
||||
|
|
@ -20,24 +19,18 @@ export class CircleLight implements ILight {
|
|||
public lightness: number
|
||||
) {}
|
||||
|
||||
boundingBox: ImmutableBoundingBox;
|
||||
|
||||
public distance(target: vec2): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public minimumDistance(target: vec2): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public serializeToUniforms(uniforms: any): void {
|
||||
const listName = CircleLight.descriptor.uniformName;
|
||||
const uniformName = CircleLight.descriptor.uniformName;
|
||||
|
||||
if (!uniforms.hasOwnProperty(listName)) {
|
||||
uniforms[listName] = [];
|
||||
if (!uniforms.hasOwnProperty(uniformName)) {
|
||||
uniforms[uniformName] = [];
|
||||
}
|
||||
|
||||
uniforms[listName].push({
|
||||
uniforms[uniformName].push({
|
||||
center: this.center,
|
||||
radius: this.radius,
|
||||
value: this.value,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { IDrawable } from '../i-drawable';
|
||||
|
||||
export interface ILight extends IDrawable {}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { ILight } from './i-light';
|
|||
import { vec2, vec3 } from 'gl-matrix';
|
||||
import { IDrawableDescriptor } from '../i-drawable-descriptor';
|
||||
import { settings } from '../../settings';
|
||||
import { ImmutableBoundingBox } from '../../../physics/containers/immutable-bounding-box';
|
||||
import { GameObject } from '../../../objects/game-object';
|
||||
|
||||
export class PointLight implements ILight {
|
||||
|
|
@ -20,16 +19,10 @@ export class PointLight implements ILight {
|
|||
public lightness: number
|
||||
) {}
|
||||
|
||||
boundingBox: ImmutableBoundingBox;
|
||||
|
||||
public distance(target: vec2): number {
|
||||
return vec2.distance(this.center, target) - this.radius;
|
||||
}
|
||||
|
||||
public minimumDistance(target: vec2): number {
|
||||
return vec2.distance(this.center, target) - this.radius;
|
||||
}
|
||||
|
||||
public serializeToUniforms(uniforms: any): void {
|
||||
const listName = PointLight.descriptor.uniformName;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue