generated from GlennFolker/MindustryModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2cd8a4
commit 0318f24
Showing
14 changed files
with
125 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#define HIGHP | ||
|
||
in vec2 v_texCoords; | ||
|
||
out vec4 fragColor; | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
#define HIGHP | ||
|
||
in vec3 a_position; | ||
in vec4 a_position; | ||
in vec2 a_texCoord0; | ||
|
||
out vec3 v_position; | ||
|
||
uniform mat4 u_proj; | ||
uniform mat4 u_trans; | ||
uniform float u_radius; | ||
out vec2 v_texCoords; | ||
|
||
void main(){ | ||
vec4 pos = u_trans * vec4(a_position, 1.0); | ||
|
||
v_position = pos.xyz; | ||
gl_Position = u_proj * pos; | ||
v_texCoords = a_texCoord0; | ||
gl_Position = a_position; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,51 @@ | ||
package confictura.graphics.shaders; | ||
|
||
import arc.graphics.Cubemap.*; | ||
import arc.graphics.g3d.*; | ||
import arc.math.geom.*; | ||
import arc.util.*; | ||
import confictura.graphics.gl.*; | ||
import confictura.world.celestial.*; | ||
|
||
import static arc.Core.*; | ||
import static confictura.graphics.CShaders.*; | ||
|
||
public class BlackHoleShader extends Gl30Shader{ | ||
private static final Mat3D mat = new Mat3D(); | ||
|
||
public Camera3D camera; | ||
public Mat3D[] cubemapView = new Mat3D[CubemapSide.values().length]; | ||
public BlackHole planet; | ||
|
||
public BlackHoleShader(){ | ||
super(file("black-hole.vert"), file("black-hole.frag")); | ||
for(int i = 0; i < cubemapView.length; i++){ | ||
cubemapView[i] = new Mat3D(); | ||
} | ||
} | ||
|
||
@Override | ||
public void apply(){ | ||
setUniformMatrix4("u_proj", camera.combined.val); | ||
setUniformMatrix4("u_invProj", camera.invProjectionView.val); | ||
setUniformf("u_far", camera.far); | ||
setUniformMatrix4("u_trans", planet.getTransform(mat).val); | ||
|
||
setUniformf("u_camPos", camera.position); | ||
setUniformf("u_viewport", graphics.getWidth(), graphics.getHeight()); | ||
setUniformf("u_relCamPos", Tmp.v31.set(camera.position).sub(planet.position)); | ||
setUniformf("u_center", planet.position); | ||
|
||
setUniformf("u_radius", planet.radius); | ||
setUniformf("u_horizon", planet.horizon); | ||
|
||
//planet.ref.getTexture().bind(0); | ||
for(int i = 0; i < cubemapView.length; i++){ | ||
setUniformMatrix4("u_cubeView[" + i + "]", cubemapView[i].val); | ||
setUniformMatrix4("u_cubeInvView[" + i + "]", mat.set(cubemapView[i]).inv().val); | ||
} | ||
|
||
setUniformMatrix4("u_proj", camera.combined.val); | ||
setUniformMatrix4("u_invProj", camera.invProjectionView.val); | ||
setUniformf("u_depthRange", camera.near, camera.far); | ||
|
||
planet.pov.getDepthTexture().bind(1); | ||
planet.pov.getTexture().bind(0); | ||
setUniformi("u_depth", 1); | ||
setUniformi("u_ref", 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.