p3nGu1nZz commited on
Commit
1cf08b7
·
1 Parent(s): e8a6c79

Enhanced vertex data function

Browse files
Files changed (1) hide show
  1. index.js +6 -5
index.js CHANGED
@@ -75,8 +75,8 @@ function GenerateIndices(maxGlyphs) {
75
  }
76
 
77
  function GenerateVertexDataAndTexture(glyphCanvas) {
78
- const { vertexData, numGlyphs, width, height } = generateGlyphVerticesForText('Hello\nworld!\nText in\nWebGPU!', COLORS, config, glyphCanvas);
79
- state.device.queue.writeBuffer(state.vertexBuffer, 0, vertexData);
80
 
81
  state.texture = createTextureFromSource(state.device, glyphCanvas, { mips: true });
82
  state.sampler = state.device.createSampler({
@@ -101,9 +101,10 @@ function GenerateVertexDataAndTexture(glyphCanvas) {
101
  ],
102
  });
103
 
104
- state.numGlyphs = numGlyphs;
105
- state.width = width;
106
- state.height = height;
 
107
  }
108
 
109
  function GameLoop(context) {
 
75
  }
76
 
77
  function GenerateVertexDataAndTexture(glyphCanvas) {
78
+ const glyphData = generateGlyphVerticesForText('Hello\nworld!\nText in\nWebGPU!', COLORS, config, glyphCanvas);
79
+ state.device.queue.writeBuffer(state.vertexBuffer, 0, glyphData.vertexData);
80
 
81
  state.texture = createTextureFromSource(state.device, glyphCanvas, { mips: true });
82
  state.sampler = state.device.createSampler({
 
101
  ],
102
  });
103
 
104
+ // Update state with glyph details
105
+ state.numGlyphs = glyphData.numGlyphs;
106
+ state.width = glyphData.width;
107
+ state.height = glyphData.height;
108
  }
109
 
110
  function GameLoop(context) {