mirror of
https://github.com/LucasDower/ObjToSchematic.git
synced 2025-12-11 20:15:30 +01:00
Rename alphaValue to alphaFactor
This commit is contained in:
parent
7c07217b3b
commit
7108100956
@ -4,7 +4,7 @@ uniform sampler2D u_texture;
|
||||
uniform sampler2D u_alpha;
|
||||
uniform bool u_useAlphaMap;
|
||||
uniform bool u_useAlphaChannel;
|
||||
uniform float u_alphaValue;
|
||||
uniform float u_alphaFactor;
|
||||
|
||||
varying float v_lighting;
|
||||
varying vec2 v_texcoord;
|
||||
@ -107,7 +107,7 @@ void main() {
|
||||
alpha = u_useAlphaChannel ? texture2D(u_alpha, tex).a : texture2D(u_alpha, tex).r;
|
||||
}
|
||||
|
||||
alpha *= u_alphaValue;
|
||||
alpha *= u_alphaFactor;
|
||||
|
||||
alpha = dither8x8(gl_FragCoord.xy, alpha);
|
||||
if (alpha < 0.5)
|
||||
|
||||
@ -389,7 +389,7 @@ export class ObjImporter extends IImporter {
|
||||
type: MaterialType.textured,
|
||||
path: this._currentTexture,
|
||||
alphaPath: this._currentTransparencyTexture === '' ? undefined : this._currentTransparencyTexture,
|
||||
alphaValue: this._currentAlpha,
|
||||
alphaFactor: this._currentAlpha,
|
||||
};
|
||||
this._currentTransparencyTexture = '';
|
||||
} else {
|
||||
|
||||
@ -29,7 +29,7 @@ export interface TexturedMaterial {
|
||||
path: string;
|
||||
type: MaterialType.textured;
|
||||
alphaPath?: string;
|
||||
alphaValue: number;
|
||||
alphaFactor: number;
|
||||
}
|
||||
export type MaterialMap = {[key: string]: (SolidMaterial | TexturedMaterial)};
|
||||
|
||||
@ -314,7 +314,7 @@ export class Mesh {
|
||||
} else {
|
||||
ASSERT(materialName in this._loadedTextures, 'Sampling texture that is not loaded');
|
||||
const colour = this._loadedTextures[materialName].getRGBA(uv, textureFiltering);
|
||||
colour.a *= material.alphaValue;
|
||||
colour.a *= material.alphaFactor;
|
||||
return colour;
|
||||
}
|
||||
}
|
||||
@ -387,7 +387,7 @@ export class Mesh {
|
||||
} else {
|
||||
materials[materialName] = {
|
||||
type: MaterialType.textured,
|
||||
alphaValue: material.alphaValue,
|
||||
alphaFactor: material.alphaFactor,
|
||||
alphaPath: material.alphaPath,
|
||||
path: material.path,
|
||||
};
|
||||
|
||||
@ -184,7 +184,7 @@ export class Renderer {
|
||||
src: material.path,
|
||||
mag: this._gl.LINEAR,
|
||||
}),
|
||||
alphaValue: material.alphaValue,
|
||||
alphaFactor: material.alphaFactor,
|
||||
alpha: material.alphaPath ? twgl.createTexture(this._gl, {
|
||||
src: material.alphaPath,
|
||||
mag: this._gl.LINEAR,
|
||||
@ -295,7 +295,7 @@ export class Renderer {
|
||||
u_alpha: materialBuffer.material.alpha,
|
||||
u_useAlphaMap: materialBuffer.material.alpha !== undefined,
|
||||
u_useAlphaChannel: materialBuffer.material.useAlphaChannel,
|
||||
u_alphaValue: materialBuffer.material.alphaValue,
|
||||
u_alphaFactor: materialBuffer.material.alphaFactor,
|
||||
});
|
||||
} else {
|
||||
this._drawRegister(materialBuffer.buffer, ShaderManager.Get.solidTriProgram, {
|
||||
|
||||
@ -33,7 +33,6 @@ export class Texture {
|
||||
|
||||
constructor(filename: string, transparencyFilename?: string) {
|
||||
ASSERT(path.isAbsolute(filename));
|
||||
const filePath = path.parse(filename);
|
||||
|
||||
this._image = this._loadImageFile(filename);
|
||||
|
||||
|
||||
@ -16,4 +16,4 @@ test('Voxel neighbours', () => {
|
||||
expect(voxelMesh.hasNeighbour(new Vector3(1, 2, 3).add(new Vector3(-1, -1, 0)), new Vector3(1, 1, 0))).toBe(true);
|
||||
expect(voxelMesh.hasNeighbour(new Vector3(1, 2, 3).add(new Vector3(1, -1, 1)), new Vector3(-1, 1, -1))).toBe(true);
|
||||
expect(voxelMesh.hasNeighbour(new Vector3(1, 2, 3).add(new Vector3(-1, 0, 1)), new Vector3(1, 0, -1))).toBe(true);
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user