Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Source.ShaderAPI.Gl46/ShaderAPIGl46.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ private unsafe void CreateMatrixStacks() {
uboClipPlanes = glCreateBuffer();
glObjectLabel(GL_BUFFER, uboClipPlanes, "ShaderAPI User Clip Planes UBO");
glNamedBufferData(uboClipPlanes, sizeof(Vector4) * Gl46.HardwareConfig.MAXUSERCLIPPLANES, null, GL_DYNAMIC_DRAW);
for (int i = 0; i < Gl46.HardwareConfig.MAXUSERCLIPPLANES; i++)
UploadNoClipPlane(i);
UniformBufferBindings.Bind(UniformBufferBindingLocation.UserClipPlanes, uboClipPlanes);
}

Expand Down Expand Up @@ -3473,10 +3475,18 @@ public void EnableClipPlane(int index, bool bEnable) {
else {
UserClipPlaneEnabled &= ~(1 << index);
glDisable(GL_CLIP_DISTANCE0 + index);
UploadNoClipPlane(index);
}
}
}

private unsafe void UploadNoClipPlane(int index) {
Vector4 noClip = new(0, 0, 0, 1);
glNamedBufferSubData(uboClipPlanes, index * sizeof(Vector4), sizeof(Vector4), &noClip);
UserClipPlaneProj[index] = noClip;
UserClipPlaneChanged |= 1 << index;
}

public void EnableFastClip(bool enable) {
throw new NotImplementedException("Incomplete port of IShaderAPI");
}
Expand Down
Loading