Skip to content

Commit

Permalink
fix: basic resource is also
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxudong committed Nov 21, 2024
1 parent e252e1b commit 26b9060
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core/src/BasicResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { MeshTopology } from "./graphic/enums/MeshTopology";
import { VertexElementFormat } from "./graphic/enums/VertexElementFormat";
import { Material } from "./material";
import { ModelMesh } from "./mesh";
import { BlendFactor, BlendOperation } from "./shader";
import { Shader } from "./shader/Shader";
import { Texture, Texture2D, TextureCube, TextureCubeFace } from "./texture";
import { Texture2DArray } from "./texture/Texture2DArray";
Expand Down Expand Up @@ -46,6 +47,14 @@ export class BasicResources {
blitMaterial._addReferCount(1);
blitMaterial.renderState.depthState.enabled = false;
blitMaterial.renderState.depthState.writeEnabled = false;
const blendState = blitMaterial.renderState.blendState.targetBlendState;

blendState.enabled = true;
blendState.sourceColorBlendFactor = BlendFactor.SourceAlpha;
blendState.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;
blendState.sourceAlphaBlendFactor = BlendFactor.One;
blendState.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
blendState.colorBlendOperation = blendState.alphaBlendOperation = BlendOperation.Add;

this.blitMesh = this._createBlitMesh(engine, vertices);
this.flipYBlitMesh = this._createBlitMesh(engine, flipYVertices);
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/RenderPipeline/PipelineUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Vector4 } from "@galacean/engine-math";
import { Engine } from "../Engine";
import { CameraClearFlags } from "../enums/CameraClearFlags";
import { Material } from "../material";
import { ShaderProperty } from "../shader";
import { Shader } from "../shader/Shader";
Expand Down Expand Up @@ -194,6 +195,11 @@ export class PipelineUtils {
program.uploadAll(program.materialUniformBlock, blitMaterial.shaderData);
program.uploadUnGroupTextures();

if (!material) {
blitMaterial.renderState.blendState.targetBlendState.enabled = !(

Check warning on line 199 in packages/core/src/RenderPipeline/PipelineUtils.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/RenderPipeline/PipelineUtils.ts#L199

Added line #L199 was not covered by tests
context.camera.clearFlags & CameraClearFlags.Color
);
}
(pass._renderState || blitMaterial.renderState)._applyStates(
engine,
false,
Expand Down

0 comments on commit 26b9060

Please sign in to comment.