Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShaderData add get shader properties ability #1030

Merged
merged 14 commits into from
Sep 14, 2022

Conversation

GuoLei1990
Copy link
Member

@GuoLei1990 GuoLei1990 commented Sep 10, 2022

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  1. ShaderData add getProperties(out: ShaderProperty[]): void and getProperties(): ShaderProperty[] method, developer can get all shaderProperties that have been set on this shaderData.

example:

  const properties = new Array<ShaderProperty>();
  shaderData.getProperties(properties);
  for (let i = 0, n = properties.length; i < n; i++) {
    const property = properties[i];
    switch (property.type) {
      case ShaderPropertyType.Float:
        const floatValue= shaderData.getFloat(property);
        or
        const floatValue= <number>shaderData.getPropertyValue(property);
        console.log(floatValue);
        break;
      case ShaderPropertyType.Texture:
        .......
        break;
     ........
    }
  }
  1. Add Material.test.ts

@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2022

Codecov Report

Merging #1030 (0e3fb28) into dev/0.9 (269ab02) will increase coverage by 3.85%.
The diff coverage is 66.66%.

@@             Coverage Diff             @@
##           dev/0.9    #1030      +/-   ##
===========================================
+ Coverage    29.52%   33.38%   +3.85%     
===========================================
  Files          331      332       +1     
  Lines        14704    14730      +26     
  Branches      2251     2261      +10     
===========================================
+ Hits          4341     4917     +576     
+ Misses        9849     9268     -581     
- Partials       514      545      +31     
Impacted Files Coverage Δ
packages/core/src/shader/ShaderProgram.ts 0.44% <0.00%> (ø)
packages/core/src/shader/ShaderData.ts 67.82% <74.35%> (+13.37%) ⬆️
packages/core/src/shader/Shader.ts 40.54% <100.00%> (+0.81%) ⬆️
packages/core/src/shader/ShaderProperty.ts 100.00% <100.00%> (ø)
...ckages/core/src/shader/enums/ShaderPropertyType.ts 100.00% <100.00%> (ø)
packages/core/src/Engine.ts 62.11% <0.00%> (-0.79%) ⬇️
packages/rhi-webgl/src/GLTexture.ts 35.75% <0.00%> (-0.19%) ⬇️
packages/core/src/shadow/ShadowUtils.ts 1.51% <0.00%> (-0.03%) ⬇️
...ckages/core/src/shadow/CascadedShadowCasterPass.ts 3.70% <0.00%> (+0.53%) ⬆️
packages/core/src/asset/ResourceManager.ts 15.47% <0.00%> (+1.19%) ⬆️
... and 19 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@GuoLei1990 GuoLei1990 changed the title feat: shaderData add getProperties ability feat: shaderData add get assigned shader properties ability Sep 10, 2022
@GuoLei1990 GuoLei1990 added enhancement New feature or request shader Shader related functions labels Sep 10, 2022
@GuoLei1990 GuoLei1990 self-assigned this Sep 10, 2022
@GuoLei1990 GuoLei1990 added this to the 0.9 milestone Sep 10, 2022
@GuoLei1990 GuoLei1990 linked an issue Sep 10, 2022 that may be closed by this pull request
@GuoLei1990 GuoLei1990 changed the title feat: shaderData add get assigned shader properties ability feat: shaderData add get shader properties ability Sep 10, 2022
@gz65555
Copy link
Collaborator

gz65555 commented Sep 13, 2022

Add Unit Test for new API getShaderProperties

Done

…rData-improve

* commit 'f34d3ace905a74861fb2852afa0a2ce99fe3032d':
  Fix text renderer element not render state (galacean#1043)
  Shader support multi shader pass (galacean#948)
  v0.9.0-alpha.4
  fix: use rgba8 as downgrade shadow texture (galacean#1033)
  v0.9.0-alpha.3
  shadowMap using color texture when platform not support depthTexture (galacean#1029)
  Fix `SkinnedMeshRenderer` clone bug (galacean#1028)
@GuoLei1990 GuoLei1990 changed the title feat: shaderData add get shader properties ability shaderData add get shader properties ability Sep 14, 2022
@GuoLei1990 GuoLei1990 changed the title shaderData add get shader properties ability ShaderData add get shader properties ability Sep 14, 2022
@GuoLei1990 GuoLei1990 merged commit 0dcf39e into galacean:dev/0.9 Sep 14, 2022
@GuoLei1990 GuoLei1990 deleted the pr/shaderData-improve branch September 22, 2022 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request shader Shader related functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get Material Macros and Uniforms(key and value)
3 participants