Refactor rendering
This commit is contained in:
parent
edca93fcfe
commit
76282a4cf7
25 changed files with 239 additions and 213 deletions
|
|
@ -2,6 +2,7 @@ import { IDrawable } from './i-drawable';
|
|||
import { TunnelShape } from '../../shapes/types/tunnel-shape';
|
||||
import { IDrawableDescriptor } from './i-drawable-descriptor';
|
||||
import { settings } from '../settings';
|
||||
import { mat2d, vec2 } from 'gl-matrix';
|
||||
|
||||
export class DrawableTunnel extends TunnelShape implements IDrawable {
|
||||
public static descriptor: IDrawableDescriptor = {
|
||||
|
|
@ -10,17 +11,25 @@ export class DrawableTunnel extends TunnelShape implements IDrawable {
|
|||
shaderCombinationSteps: settings.shaderCombinations.lineSteps,
|
||||
};
|
||||
|
||||
public serializeToUniforms(uniforms: any): void {
|
||||
public serializeToUniforms(
|
||||
uniforms: any,
|
||||
scale: number,
|
||||
transform: mat2d
|
||||
): void {
|
||||
const uniformName = DrawableTunnel.descriptor.uniformName;
|
||||
if (!uniforms.hasOwnProperty(uniformName)) {
|
||||
uniforms[uniformName] = [];
|
||||
}
|
||||
|
||||
uniforms[uniformName].push({
|
||||
from: this.from,
|
||||
toFromDelta: this.toFromDelta,
|
||||
fromRadius: this.fromRadius,
|
||||
toRadius: this.toRadius,
|
||||
from: vec2.transformMat2d(vec2.create(), this.from, transform),
|
||||
toFromDelta: vec2.transformMat2d(
|
||||
vec2.create(),
|
||||
this.toFromDelta,
|
||||
transform
|
||||
),
|
||||
fromRadius: this.fromRadius * scale,
|
||||
toRadius: this.toRadius * scale,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue