Skip to content

Commit 33b6208

Browse files
author
Daniel Leib
committed
parse some extra shader.stage parameters
1 parent 5c8720b commit 33b6208

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/shader-parser.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export interface Shader {
2828

2929
export interface ShaderStage {
3030
map?: string;
31+
rgbGen?: string;
32+
tcGen?: string;
33+
tcMod?: string;
34+
blendfunc?: string;
3135
}
3236

3337
function parseShader(tokenizer: Tokenizer, name: string): Shader {
@@ -139,13 +143,21 @@ function parseShaderStage(tokenizer: Tokenizer): ShaderStage {
139143
}
140144
break;
141145
case 'blendfunc':
146+
stage.blendfunc = tokenizer.skipLine().trim();
147+
break;
142148
case 'rgbgen':
149+
stage.rgbGen = tokenizer.skipLine().trim();
150+
break;
143151
case 'tcgen':
152+
stage.tcGen = tokenizer.skipLine().trim();
153+
break;
154+
case 'tcmod':
155+
stage.tcMod = tokenizer.skipLine().trim();
156+
break;
144157
case 'alphagen':
145158
case 'animmap':
146159
case 'clampmap':
147160
case 'videomap':
148-
case 'tcmod':
149161
case 'detail':
150162
case 'alphafunc':
151163
case 'depthfunc':

src/utils/tokenizer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export class Tokenizer {
6161
/**
6262
* Skips all chars until a new line was found
6363
*/
64-
public skipLine() {
64+
public skipLine(): string {
65+
let str = '';
6566
while (this.text.length > this.index) {
6667
const char = this.text[this.index++];
6768
if (char === '\r') {
@@ -74,7 +75,9 @@ export class Tokenizer {
7475
this.lineNo += 1;
7576
break;
7677
}
78+
str += char;
7779
}
80+
return str;
7881
}
7982

8083
public skipWhitespace(): boolean {

0 commit comments

Comments
 (0)