This commit is contained in:
parent
db89bc4ff4
commit
7cb7ef646c
4
.vscode/c_cpp_properties.json
vendored
4
.vscode/c_cpp_properties.json
vendored
@ -4,7 +4,7 @@
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"C:/Program Files/Eclipse Adoptium/jdk-17.0.10.7-hotspot/include/**"
|
||||
"C:/Program Files/Eclipse Adoptium/jdk-21.0.5.11-hotspot/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
@ -12,7 +12,7 @@
|
||||
"_UNICODE"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.19041.0",
|
||||
"compilerPath": "C:/Program Files/w64devkit/bin/gcc.exe",
|
||||
"compilerPath": "C:/ProgramData/mingw64/mingw64/bin/gcc.exe",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "windows-gcc-x64"
|
||||
|
||||
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"vscjava.vscode-java-pack"
|
||||
]
|
||||
}
|
||||
11
README.md
Normal file
11
README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Fluid Sim
|
||||
|
||||
|
||||
|
||||
## How to run
|
||||
|
||||
Clone with `git clone --recurse-submodules git@git.austinwhoover.com:studiorailgun/fluid-sim.git`
|
||||
|
||||
Then run with VSCode debug plugin
|
||||
|
||||
|
||||
@ -9,15 +9,9 @@ import java.nio.FloatBuffer;
|
||||
import java.nio.file.Files;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.joml.Vector2i;
|
||||
import org.joml.Vector3i;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
/**
|
||||
* Simulates a fluid via opencl
|
||||
@ -115,7 +109,6 @@ public class FluidSim {
|
||||
FloatBuffer vf = vVector[13].asFloatBuffer();
|
||||
FloatBuffer wf = wVector[13].asFloatBuffer();
|
||||
|
||||
Random rand = new Random(1);
|
||||
//make a cube of water in the center
|
||||
for(int i = 0; i < DIM; i++){
|
||||
for(int j = 0; j < DIM; j++){
|
||||
|
||||
@ -2,13 +2,9 @@ package electrosphere;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.joml.Vector3i;
|
||||
@ -29,12 +25,11 @@ public class Main {
|
||||
|
||||
public static void main(String args[]){
|
||||
|
||||
int dim = 1;
|
||||
int vdim = 1;
|
||||
int dim = 3;
|
||||
int vdim = 3;
|
||||
int i = 0;
|
||||
long time = 0;
|
||||
long lastTime = 0;
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
try {
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ package electrosphere.render;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL;
|
||||
import org.lwjgl.opengl.GL44;
|
||||
@ -38,9 +37,6 @@ public class GLFWContext {
|
||||
GLFW.glfwMakeContextCurrent(window);
|
||||
//Maximize it
|
||||
GLFW.glfwMaximizeWindow(window);
|
||||
//grab actual framebuffer
|
||||
int bufferWidth = 0;
|
||||
int bufferHeight = 0;
|
||||
|
||||
try(MemoryStack stack = MemoryStack.stackPush()){
|
||||
IntBuffer xBuffer = MemoryUtil.memAllocInt(1);
|
||||
@ -48,9 +44,6 @@ public class GLFWContext {
|
||||
GLFW.glfwGetFramebufferSize(window, xBuffer, yBuffer);
|
||||
MemoryUtil.memFree(xBuffer);
|
||||
MemoryUtil.memFree(yBuffer);
|
||||
|
||||
bufferWidth = xBuffer.get();
|
||||
bufferHeight = yBuffer.get();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
package electrosphere.render;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.file.Files;
|
||||
@ -17,11 +14,8 @@ import java.util.Map;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector3i;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL33;
|
||||
import org.lwjgl.opengl.GL44;
|
||||
import org.lwjgl.opengl.GL45;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import electrosphere.FluidSim;
|
||||
@ -110,7 +104,6 @@ public class Mesh {
|
||||
FloatBuffer NormalArrayBufferData;
|
||||
if(normalCount > 0){
|
||||
NormalArrayBufferData = MemoryUtil.memAllocFloat(normalCount * 3);
|
||||
float[] temp = new float[3];
|
||||
for(float normalValue : data.normals){
|
||||
NormalArrayBufferData.put(normalValue);
|
||||
}
|
||||
@ -242,8 +235,7 @@ public class Mesh {
|
||||
|
||||
public static void initShaderProgram(){
|
||||
String vsSrc = "";
|
||||
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
|
||||
try (BufferedReader is = new BufferedReader(Files.newBufferedReader(new File("C:\\Users\\satellite\\Documents\\fluid-sim\\src\\main\\resources\\shader.vs").toPath()))){
|
||||
try (BufferedReader is = new BufferedReader(Files.newBufferedReader(new File("./src/main/resources/shader.vs").toPath()))){
|
||||
String temp;
|
||||
while((temp = is.readLine())!=null){
|
||||
vsSrc = vsSrc + temp + "\n";
|
||||
@ -254,7 +246,7 @@ public class Mesh {
|
||||
}
|
||||
|
||||
String fsSrc = "";
|
||||
try (BufferedReader is = new BufferedReader(Files.newBufferedReader(new File("C:\\Users\\satellite\\Documents\\fluid-sim\\src\\main\\resources\\shader.fs").toPath()))){
|
||||
try (BufferedReader is = new BufferedReader(Files.newBufferedReader(new File("./src/main/resources/shader.fs").toPath()))){
|
||||
String temp;
|
||||
while((temp = is.readLine())!=null){
|
||||
fsSrc = fsSrc + temp + "\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user