Compare commits

..

No commits in common. "master" and "jenkinsAutoTesting" have entirely different histories.

8 changed files with 33 additions and 27 deletions

View File

@ -4,7 +4,7 @@
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/Program Files/Eclipse Adoptium/jdk-21.0.5.11-hotspot/include/**"
"C:/Program Files/Eclipse Adoptium/jdk-17.0.10.7-hotspot/include/**"
],
"defines": [
"_DEBUG",
@ -12,7 +12,7 @@
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/ProgramData/mingw64/mingw64/bin/gcc.exe",
"compilerPath": "C:/Program Files/w64devkit/bin/gcc.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-gcc-x64"

View File

@ -1,6 +0,0 @@
{
"recommendations": [
"ms-vscode.cpptools-extension-pack",
"vscjava.vscode-java-pack"
]
}

View File

@ -1,11 +0,0 @@
# 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

View File

@ -10,10 +10,6 @@
#include "./velocitystep.c"
#include "./densitystep.c"
#ifndef SAVE_STEPS
#define SAVE_STEPS 0
#endif
#define DIM 18
#define LINEARSOLVERTIMES 20

View File

@ -9,9 +9,15 @@ 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
@ -109,6 +115,7 @@ 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++){

View File

@ -2,9 +2,13 @@ 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;
@ -25,11 +29,12 @@ public class Main {
public static void main(String args[]){
int dim = 3;
int vdim = 3;
int dim = 1;
int vdim = 1;
int i = 0;
long time = 0;
long lastTime = 0;
Scanner scan = new Scanner(System.in);
try {

View File

@ -2,6 +2,7 @@ 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;
@ -37,6 +38,9 @@ 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);
@ -44,6 +48,9 @@ public class GLFWContext {
GLFW.glfwGetFramebufferSize(window, xBuffer, yBuffer);
MemoryUtil.memFree(xBuffer);
MemoryUtil.memFree(yBuffer);
bufferWidth = xBuffer.get();
bufferHeight = yBuffer.get();
}
//

View File

@ -1,8 +1,11 @@
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;
@ -14,8 +17,11 @@ 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;
@ -104,6 +110,7 @@ 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);
}
@ -235,7 +242,8 @@ public class Mesh {
public static void initShaderProgram(){
String vsSrc = "";
try (BufferedReader is = new BufferedReader(Files.newBufferedReader(new File("./src/main/resources/shader.vs").toPath()))){
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()))){
String temp;
while((temp = is.readLine())!=null){
vsSrc = vsSrc + temp + "\n";
@ -246,7 +254,7 @@ public class Mesh {
}
String fsSrc = "";
try (BufferedReader is = new BufferedReader(Files.newBufferedReader(new File("./src/main/resources/shader.fs").toPath()))){
try (BufferedReader is = new BufferedReader(Files.newBufferedReader(new File("C:\\Users\\satellite\\Documents\\fluid-sim\\src\\main\\resources\\shader.fs").toPath()))){
String temp;
while((temp = is.readLine())!=null){
fsSrc = fsSrc + temp + "\n";