MCPcopy
hub / github.com/sparkjsdev/spark / evaluateExtSH

Function evaluateExtSH

src/ExtSplats.ts:846–926  ·  view source on GitHub ↗
({
  coord,
  viewDir,
  numSh,
  sh1Texture,
  sh2Texture,
  sh3TextureA,
  sh3TextureB,
}: {
  coord: DynoVal<"ivec3">;
  viewDir: DynoVal<"vec3">;
  numSh: DynoVal<"int">;
  sh1Texture?: DynoUsampler2DArray<"sh1", THREE.DataArrayTexture>;
  sh2Texture?: DynoUsampler2DArray<"sh2", THREE.DataArrayTexture>;
  sh3TextureA?: DynoUsampler2DArray<"sh3", THREE.DataArrayTexture>;
  sh3TextureB?: DynoUsampler2DArray<"sh3b", THREE.DataArrayTexture>;
})

Source from the content-addressed store, hash-verified

844`);
845
846export function evaluateExtSH({
847 coord,
848 viewDir,
849 numSh,
850 sh1Texture,
851 sh2Texture,
852 sh3TextureA,
853 sh3TextureB,
854}: {
855 coord: DynoVal<"ivec3">;
856 viewDir: DynoVal<"vec3">;
857 numSh: DynoVal<"int">;
858 sh1Texture?: DynoUsampler2DArray<"sh1", THREE.DataArrayTexture>;
859 sh2Texture?: DynoUsampler2DArray<"sh2", THREE.DataArrayTexture>;
860 sh3TextureA?: DynoUsampler2DArray<"sh3", THREE.DataArrayTexture>;
861 sh3TextureB?: DynoUsampler2DArray<"sh3b", THREE.DataArrayTexture>;
862}) {
863 return new Dyno({
864 inTypes: {
865 coord: "ivec3",
866 viewDir: "vec3",
867 numSh: "int",
868 sh1Texture: "usampler2DArray",
869 sh2Texture: "usampler2DArray",
870 sh3TextureA: "usampler2DArray",
871 sh3TextureB: "usampler2DArray",
872 },
873 outTypes: { rgb: "vec3" },
874 inputs: {
875 coord,
876 viewDir,
877 numSh,
878 sh1Texture,
879 sh2Texture,
880 sh3TextureA,
881 sh3TextureB,
882 },
883 globals: () => [
884 defineEvaluateExtSH1,
885 defineEvaluateExtSH12,
886 defineEvaluateExtSH3,
887 ],
888 statements: ({ inputs, outputs }) => {
889 const lines = ["vec3 rgb = vec3(0.0);"];
890 if (inputs.sh1Texture) {
891 if (!inputs.sh2Texture) {
892 lines.push(
893 ...unindentLines(`
894 if (${inputs.numSh} >= 1) {
895 rgb = evaluateExtSH1(texelFetch(${inputs.sh1Texture}, ${inputs.coord}, 0), ${inputs.viewDir});
896 }
897 `),
898 );
899 } else {
900 lines.push(
901 ...unindentLines(`
902 if (${inputs.numSh} == 1) {
903 rgb = evaluateExtSH1(texelFetch(${inputs.sh1Texture}, ${inputs.coord}, 0), ${inputs.viewDir});

Callers 2

constructorMethod · 0.90
fetchSplatMethod · 0.85

Calls 1

unindentLinesFunction · 0.90

Tested by

no test coverage detected