39 lines
832 B
TypeScript
39 lines
832 B
TypeScript
import { Camera } from "./Camera";
|
|
|
|
export class Shader {
|
|
public _shader:CShader;
|
|
|
|
constructor() {
|
|
this._shader = shaderCreate();
|
|
}
|
|
|
|
public use() {
|
|
shaderUse(this._shader);
|
|
}
|
|
|
|
public setCamera(camera:Camera) {
|
|
shaderUseCamera(this._shader, camera._camera);
|
|
}
|
|
|
|
public setPosition(
|
|
x:number, y:number, z:number, pitch:number, yaw:number, roll:number
|
|
) {
|
|
shaderUsePosition(this._shader, x,y,z, pitch,yaw,roll);
|
|
}
|
|
|
|
public setPositionAndScale(
|
|
x:number, y:number, z:number,
|
|
pitch:number, yaw:number, roll:number,
|
|
sx:number, sy:number, sz:number
|
|
) {
|
|
shaderUsePositionAndScale(this._shader, x,y,z, pitch,yaw,roll, sx,sy,sz);
|
|
}
|
|
|
|
public setTexture(texture:CTexture) {
|
|
shaderUseTexture(this._shader, texture);
|
|
}
|
|
|
|
public dispose() {
|
|
shaderDispose(this._shader);
|
|
}
|
|
} |