Skip to content

Commit

Permalink
fix: arc shader using varyings before assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
hpcreery committed Jul 31, 2024
1 parent efb128f commit 75b18ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/renderer/src/renderer/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as Symbols from './symbols'
import { glFloatSize } from './constants'
import { FeatureTypeIdentifier, Binary } from './types'
import { MacroRenderer, StepAndRepeatRenderer } from './layer'
import onChange from 'on-change'

import PadFrag from '../shaders/src/Pad.frag'
import PadVert from '../shaders/src/Pad.vert'
Expand Down Expand Up @@ -1001,18 +1000,17 @@ export class SymbolShaderCollection {
return this
}
const symbols = Array.from(this.symbols.values()).map((symbol, i) => {
// symbol.sym_num = i
onChange.target(symbol).sym_num.value = i
symbol.sym_num.value = i
return this.getSymbolParameters(symbol)
})
// TODO: make symbols texture fit to max texture size
this.texture({
width: SYMBOL_PARAMETERS.length,
height: symbols.length,
type: 'float',
format: 'luminance',
data: symbols
})
// console.log('refreshing symbols', this.symbols.size)
return this
}
}
Expand Down
1 change: 0 additions & 1 deletion src/renderer/src/renderer/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import REGL from 'regl'
import { vec2, vec3, mat3 } from 'gl-matrix'
import * as Shapes from './shapes'
import * as Symbols from './symbols'
// import onChange from 'on-change'
import { Binary, Transform, Units, BoundingBox } from './types'
import {
ArcAttachments,
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/src/shaders/src/Arc.vert
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ void main() {

float Aspect = u_Resolution.y / u_Resolution.x;

float t_Outer_Dia = pullSymbolParameter(u_Parameters.outer_dia, int(v_SymNum));
float t_Width = pullSymbolParameter(u_Parameters.width, int(v_SymNum));
float t_Height = pullSymbolParameter(u_Parameters.height, int(v_SymNum));
float t_Outer_Dia = pullSymbolParameter(u_Parameters.outer_dia, int(a_SymNum));
float t_Width = pullSymbolParameter(u_Parameters.width, int(a_SymNum));
float t_Height = pullSymbolParameter(u_Parameters.height, int(a_SymNum));
float OD = max(t_Outer_Dia, max(t_Width, t_Height));

vec2 ShapeSize = vec2(OD, OD) + vec2(pixel_size, pixel_size);
Expand Down

0 comments on commit 75b18ce

Please sign in to comment.