Skip to content

Commit

Permalink
Merge branch 'main' into matias-hlmsCustom3
Browse files Browse the repository at this point in the history
  • Loading branch information
iche033 authored Jan 27, 2022
2 parents 00a55fd + 30f9a5e commit 409b9a2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion ogre2/src/media/materials/programs/GLSL/point_fs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#version 330

uniform vec4 color;
in vec3 ptColor;

out vec4 fragColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fragment float4 main_metal
// due to the scatter effect. We should still render particles in the color
// image
// todo(iche033) handle case when background is a cubemap
if (hasBackground == 0 && particle.x < 1e-6)
if (p.hasBackground == 0 && particle.x < 1e-6)
{
color = float4(p.backgroundColor, 1.0);
}
Expand All @@ -185,7 +185,7 @@ fragment float4 main_metal

// clamp to background color only if it is not a particle pixel
// todo(iche033) handle case when background is a cubemap
if (hasBackground == 0 && particle.x < 1e-6)
if (p.hasBackground == 0 && particle.x < 1e-6)
{
color = float4(p.backgroundColor, 1.0);
}
Expand Down
6 changes: 3 additions & 3 deletions ogre2/src/media/materials/programs/Metal/point_fs.metal
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
* limitations under the License.
*
*/

#include <metal_stdlib>
using namespace metal;

struct PS_INPUT
{
float3 ptColor;
};

struct Params
{
float4 color;
};

fragment float4 main_metal
Expand All @@ -33,5 +33,5 @@ fragment float4 main_metal
constant Params &p [[buffer(PARAMETER_SLOT)]]
)
{
return p.color;
return float4(inPs.ptColor.x, inPs.ptColor.y, inPs.ptColor.z, 1.0);
}
6 changes: 5 additions & 1 deletion ogre2/src/media/materials/programs/Metal/point_vs.metal
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@
* limitations under the License.
*
*/

#include <metal_stdlib>
using namespace metal;

struct VS_INPUT
{
float4 position [[attribute(VES_POSITION)]];
float3 normal [[attribute(VES_NORMAL)]];
};

struct PS_INPUT
{
float4 gl_Position [[position]];
float gl_PointSize [[point_size]];
float3 ptColor;
};

struct Params
Expand All @@ -45,6 +47,8 @@ vertex PS_INPUT main_metal

outVs.gl_Position = ( p.worldViewProj * input.position ).xyzw;
outVs.gl_PointSize = p.size;
// We're abusing the normal variable to hold per-point colors
outVs.ptColor = input.normal;

return outVs;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ fragment_program PointCloudFS_GLSL glsl
source point_fs.glsl
default_params
{
param_named color float4 1.0 1.0 1.0 1.0
}
}

Expand Down

0 comments on commit 409b9a2

Please sign in to comment.