Organize your god damn imports @hYdos!

pull/12/head
Caroline Bell 2020-03-02 18:48:09 -08:00 committed by hYdos
parent a54e2ef15d
commit e84b8139b3
26 changed files with 101 additions and 373 deletions

View File

@ -1,11 +1,11 @@
package com.github.halotroop.litecraft.screens; package com.github.halotroop.litecraft.screens;
import org.joml.*; import org.joml.Vector2f;
import com.github.hydos.ginger.engine.common.font.GUIText; import com.github.hydos.ginger.engine.common.font.GUIText;
import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.common.screen.Screen; import com.github.hydos.ginger.engine.common.screen.Screen;
import com.github.hydos.ginger.engine.opengl.api.*; import com.github.hydos.ginger.engine.opengl.api.GingerGL;
public class ExitGameScreen extends Screen public class ExitGameScreen extends Screen
{ {

View File

@ -6,7 +6,7 @@ import com.github.halotroop.litecraft.Litecraft;
import com.github.hydos.ginger.engine.common.api.GingerRegister; import com.github.hydos.ginger.engine.common.api.GingerRegister;
import com.github.hydos.ginger.engine.common.font.GUIText; import com.github.hydos.ginger.engine.common.font.GUIText;
import com.github.hydos.ginger.engine.common.screen.Screen; import com.github.hydos.ginger.engine.common.screen.Screen;
import com.github.hydos.ginger.engine.opengl.api.*; import com.github.hydos.ginger.engine.opengl.api.GingerGL;
public class IngameHUD extends Screen public class IngameHUD extends Screen
{ {

View File

@ -1,10 +1,7 @@
package com.github.halotroop.litecraft.world; package com.github.halotroop.litecraft.world;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.concurrent.*;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.LongConsumer; import java.util.function.LongConsumer;

View File

@ -2,7 +2,7 @@ package com.github.halotroop.litecraft.world.dimension;
import java.util.*; import java.util.*;
import com.github.halotroop.litecraft.world.gen.*; import com.github.halotroop.litecraft.world.gen.ChunkGenerator;
import com.github.halotroop.litecraft.world.gen.modifier.WorldModifier; import com.github.halotroop.litecraft.world.gen.modifier.WorldModifier;
import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.ints.*;

View File

@ -1,6 +1,6 @@
package com.github.halotroop.litecraft.world.dimension; package com.github.halotroop.litecraft.world.dimension;
import com.github.halotroop.litecraft.world.gen.*; import com.github.halotroop.litecraft.world.gen.EarthChunkGenerator;
import com.github.halotroop.litecraft.world.gen.modifier.CavesModifier; import com.github.halotroop.litecraft.world.gen.modifier.CavesModifier;
public final class Dimensions public final class Dimensions

View File

@ -1,7 +1,6 @@
package com.github.halotroop.litecraft.world.gen; package com.github.halotroop.litecraft.world.gen;
import com.github.halotroop.litecraft.world.Chunk; import com.github.halotroop.litecraft.world.*;
import com.github.halotroop.litecraft.world.World;
public interface ChunkGenerator public interface ChunkGenerator
{ {

View File

@ -4,8 +4,7 @@ import java.util.Random;
import com.github.halotroop.litecraft.types.block.*; import com.github.halotroop.litecraft.types.block.*;
import com.github.halotroop.litecraft.util.noise.OctaveSimplexNoise; import com.github.halotroop.litecraft.util.noise.OctaveSimplexNoise;
import com.github.halotroop.litecraft.world.Chunk; import com.github.halotroop.litecraft.world.*;
import com.github.halotroop.litecraft.world.World;
public class EarthChunkGenerator implements ChunkGenerator, WorldGenConstants public class EarthChunkGenerator implements ChunkGenerator, WorldGenConstants
{ {

View File

@ -2,7 +2,7 @@ package com.github.halotroop.litecraft.world.gen.modifier;
import java.util.Random; import java.util.Random;
import com.github.halotroop.litecraft.types.block.*; import com.github.halotroop.litecraft.types.block.Blocks;
import com.github.halotroop.litecraft.util.noise.OctaveSimplexNoise; import com.github.halotroop.litecraft.util.noise.OctaveSimplexNoise;
import com.github.halotroop.litecraft.world.BlockAccess; import com.github.halotroop.litecraft.world.BlockAccess;
import com.github.halotroop.litecraft.world.gen.WorldGenConstants; import com.github.halotroop.litecraft.world.gen.WorldGenConstants;

View File

@ -1,192 +1,27 @@
package com.github.hydos.ginger; package com.github.hydos.ginger;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE; import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.glfw.GLFW.GLFW_RELEASE; import static org.lwjgl.glfw.GLFWVulkan.*;
import static org.lwjgl.glfw.GLFW.glfwDestroyWindow; import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.glfw.GLFW.glfwPollEvents; import static org.lwjgl.vulkan.EXTDebugReport.*;
import static org.lwjgl.glfw.GLFW.glfwSetFramebufferSizeCallback; import static org.lwjgl.vulkan.KHRSurface.*;
import static org.lwjgl.glfw.GLFW.glfwSetKeyCallback; import static org.lwjgl.vulkan.KHRSwapchain.*;
import static org.lwjgl.glfw.GLFW.glfwSetWindowShouldClose; import static org.lwjgl.vulkan.VK10.*;
import static org.lwjgl.glfw.GLFW.glfwShowWindow;
import static org.lwjgl.glfw.GLFW.glfwTerminate;
import static org.lwjgl.glfw.GLFW.glfwWindowShouldClose;
import static org.lwjgl.glfw.GLFWVulkan.glfwCreateWindowSurface;
import static org.lwjgl.glfw.GLFWVulkan.glfwGetRequiredInstanceExtensions;
import static org.lwjgl.system.MemoryUtil.NULL;
import static org.lwjgl.system.MemoryUtil.memAddress;
import static org.lwjgl.system.MemoryUtil.memAlloc;
import static org.lwjgl.system.MemoryUtil.memAllocInt;
import static org.lwjgl.system.MemoryUtil.memAllocLong;
import static org.lwjgl.system.MemoryUtil.memAllocPointer;
import static org.lwjgl.system.MemoryUtil.memByteBuffer;
import static org.lwjgl.system.MemoryUtil.memCopy;
import static org.lwjgl.system.MemoryUtil.memFree;
import static org.lwjgl.vulkan.EXTDebugReport.VK_DEBUG_REPORT_ERROR_BIT_EXT;
import static org.lwjgl.vulkan.EXTDebugReport.VK_DEBUG_REPORT_WARNING_BIT_EXT;
import static org.lwjgl.vulkan.EXTDebugReport.vkDestroyDebugReportCallbackEXT;
import static org.lwjgl.vulkan.KHRSurface.VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
import static org.lwjgl.vulkan.KHRSurface.VK_PRESENT_MODE_FIFO_KHR;
import static org.lwjgl.vulkan.KHRSurface.VK_PRESENT_MODE_IMMEDIATE_KHR;
import static org.lwjgl.vulkan.KHRSurface.VK_PRESENT_MODE_MAILBOX_KHR;
import static org.lwjgl.vulkan.KHRSurface.VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
import static org.lwjgl.vulkan.KHRSurface.vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
import static org.lwjgl.vulkan.KHRSurface.vkGetPhysicalDeviceSurfaceFormatsKHR;
import static org.lwjgl.vulkan.KHRSurface.vkGetPhysicalDeviceSurfacePresentModesKHR;
import static org.lwjgl.vulkan.KHRSurface.vkGetPhysicalDeviceSurfaceSupportKHR;
import static org.lwjgl.vulkan.KHRSwapchain.VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
import static org.lwjgl.vulkan.KHRSwapchain.VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
import static org.lwjgl.vulkan.KHRSwapchain.VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
import static org.lwjgl.vulkan.KHRSwapchain.vkAcquireNextImageKHR;
import static org.lwjgl.vulkan.KHRSwapchain.vkCreateSwapchainKHR;
import static org.lwjgl.vulkan.KHRSwapchain.vkDestroySwapchainKHR;
import static org.lwjgl.vulkan.KHRSwapchain.vkGetSwapchainImagesKHR;
import static org.lwjgl.vulkan.KHRSwapchain.vkQueuePresentKHR;
import static org.lwjgl.vulkan.VK10.VK_ATTACHMENT_LOAD_OP_CLEAR;
import static org.lwjgl.vulkan.VK10.VK_ATTACHMENT_LOAD_OP_DONT_CARE;
import static org.lwjgl.vulkan.VK10.VK_ATTACHMENT_STORE_OP_DONT_CARE;
import static org.lwjgl.vulkan.VK10.VK_ATTACHMENT_STORE_OP_STORE;
import static org.lwjgl.vulkan.VK10.VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
import static org.lwjgl.vulkan.VK10.VK_COMMAND_BUFFER_LEVEL_PRIMARY;
import static org.lwjgl.vulkan.VK10.VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
import static org.lwjgl.vulkan.VK10.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_B8G8R8A8_UNORM;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_D16_UNORM;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_D16_UNORM_S8_UINT;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_D24_UNORM_S8_UINT;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_D32_SFLOAT;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_D32_SFLOAT_S8_UINT;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_R32G32B32_SFLOAT;
import static org.lwjgl.vulkan.VK10.VK_FORMAT_UNDEFINED;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_ASPECT_COLOR_BIT;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_ASPECT_DEPTH_BIT;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_ASPECT_STENCIL_BIT;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_LAYOUT_UNDEFINED;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_TILING_OPTIMAL;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_TYPE_2D;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
import static org.lwjgl.vulkan.VK10.VK_IMAGE_VIEW_TYPE_2D;
import static org.lwjgl.vulkan.VK10.VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
import static org.lwjgl.vulkan.VK10.VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
import static org.lwjgl.vulkan.VK10.VK_NULL_HANDLE;
import static org.lwjgl.vulkan.VK10.VK_PIPELINE_BIND_POINT_GRAPHICS;
import static org.lwjgl.vulkan.VK10.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
import static org.lwjgl.vulkan.VK10.VK_QUEUE_GRAPHICS_BIT;
import static org.lwjgl.vulkan.VK10.VK_SAMPLE_COUNT_1_BIT;
import static org.lwjgl.vulkan.VK10.VK_SHADER_STAGE_VERTEX_BIT;
import static org.lwjgl.vulkan.VK10.VK_SHARING_MODE_EXCLUSIVE;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_SUBMIT_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
import static org.lwjgl.vulkan.VK10.VK_SUCCESS;
import static org.lwjgl.vulkan.VK10.VK_TRUE;
import static org.lwjgl.vulkan.VK10.VK_VERTEX_INPUT_RATE_VERTEX;
import static org.lwjgl.vulkan.VK10.vkAllocateCommandBuffers;
import static org.lwjgl.vulkan.VK10.vkAllocateDescriptorSets;
import static org.lwjgl.vulkan.VK10.vkAllocateMemory;
import static org.lwjgl.vulkan.VK10.vkBeginCommandBuffer;
import static org.lwjgl.vulkan.VK10.vkBindBufferMemory;
import static org.lwjgl.vulkan.VK10.vkBindImageMemory;
import static org.lwjgl.vulkan.VK10.vkCreateBuffer;
import static org.lwjgl.vulkan.VK10.vkCreateCommandPool;
import static org.lwjgl.vulkan.VK10.vkCreateDescriptorPool;
import static org.lwjgl.vulkan.VK10.vkCreateDescriptorSetLayout;
import static org.lwjgl.vulkan.VK10.vkCreateFramebuffer;
import static org.lwjgl.vulkan.VK10.vkCreateImage;
import static org.lwjgl.vulkan.VK10.vkCreateImageView;
import static org.lwjgl.vulkan.VK10.vkCreateRenderPass;
import static org.lwjgl.vulkan.VK10.vkCreateSemaphore;
import static org.lwjgl.vulkan.VK10.vkDestroyFramebuffer;
import static org.lwjgl.vulkan.VK10.vkDestroySemaphore;
import static org.lwjgl.vulkan.VK10.vkEndCommandBuffer;
import static org.lwjgl.vulkan.VK10.vkGetBufferMemoryRequirements;
import static org.lwjgl.vulkan.VK10.vkGetDeviceQueue;
import static org.lwjgl.vulkan.VK10.vkGetImageMemoryRequirements;
import static org.lwjgl.vulkan.VK10.vkGetPhysicalDeviceFormatProperties;
import static org.lwjgl.vulkan.VK10.vkGetPhysicalDeviceQueueFamilyProperties;
import static org.lwjgl.vulkan.VK10.vkMapMemory;
import static org.lwjgl.vulkan.VK10.vkQueueSubmit;
import static org.lwjgl.vulkan.VK10.vkQueueWaitIdle;
import static org.lwjgl.vulkan.VK10.vkResetCommandPool;
import static org.lwjgl.vulkan.VK10.vkUnmapMemory;
import static org.lwjgl.vulkan.VK10.vkUpdateDescriptorSets;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.*;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.LongBuffer;
import org.joml.Matrix4f;
import org.lwjgl.PointerBuffer; import org.lwjgl.PointerBuffer;
import org.lwjgl.glfw.GLFWFramebufferSizeCallback; import org.lwjgl.glfw.*;
import org.lwjgl.glfw.GLFWKeyCallback; import org.lwjgl.vulkan.*;
import org.lwjgl.vulkan.VkAttachmentDescription;
import org.lwjgl.vulkan.VkAttachmentReference;
import org.lwjgl.vulkan.VkBufferCreateInfo;
import org.lwjgl.vulkan.VkCommandBuffer;
import org.lwjgl.vulkan.VkCommandBufferAllocateInfo;
import org.lwjgl.vulkan.VkCommandBufferBeginInfo;
import org.lwjgl.vulkan.VkCommandPoolCreateInfo;
import org.lwjgl.vulkan.VkDescriptorBufferInfo;
import org.lwjgl.vulkan.VkDescriptorPoolCreateInfo;
import org.lwjgl.vulkan.VkDescriptorPoolSize;
import org.lwjgl.vulkan.VkDescriptorSetAllocateInfo;
import org.lwjgl.vulkan.VkDescriptorSetLayoutBinding;
import org.lwjgl.vulkan.VkDescriptorSetLayoutCreateInfo;
import org.lwjgl.vulkan.VkDevice;
import org.lwjgl.vulkan.VkExtent2D;
import org.lwjgl.vulkan.VkFormatProperties;
import org.lwjgl.vulkan.VkFramebufferCreateInfo;
import org.lwjgl.vulkan.VkImageCreateInfo;
import org.lwjgl.vulkan.VkImageViewCreateInfo;
import org.lwjgl.vulkan.VkInstance;
import org.lwjgl.vulkan.VkMemoryAllocateInfo;
import org.lwjgl.vulkan.VkMemoryRequirements;
import org.lwjgl.vulkan.VkPhysicalDevice;
import org.lwjgl.vulkan.VkPhysicalDeviceMemoryProperties;
import org.lwjgl.vulkan.VkPipelineVertexInputStateCreateInfo;
import org.lwjgl.vulkan.VkPresentInfoKHR;
import org.lwjgl.vulkan.VkQueue;
import org.lwjgl.vulkan.VkQueueFamilyProperties;
import org.lwjgl.vulkan.VkRenderPassCreateInfo;
import org.lwjgl.vulkan.VkSemaphoreCreateInfo;
import org.lwjgl.vulkan.VkSubmitInfo;
import org.lwjgl.vulkan.VkSubpassDescription;
import org.lwjgl.vulkan.VkSurfaceCapabilitiesKHR;
import org.lwjgl.vulkan.VkSurfaceFormatKHR;
import org.lwjgl.vulkan.VkSwapchainCreateInfoKHR;
import org.lwjgl.vulkan.VkVertexInputAttributeDescription;
import org.lwjgl.vulkan.VkVertexInputBindingDescription;
import org.lwjgl.vulkan.VkWriteDescriptorSet;
import com.github.hydos.ginger.engine.common.info.RenderAPI; import com.github.hydos.ginger.engine.common.info.RenderAPI;
import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.vulkan.VKConstants; import com.github.hydos.ginger.engine.vulkan.VKConstants;
import com.github.hydos.ginger.engine.vulkan.memory.VKMemory; import com.github.hydos.ginger.engine.vulkan.memory.VKMemory;
import com.github.hydos.ginger.engine.vulkan.render.ubo.Ubo; import com.github.hydos.ginger.engine.vulkan.render.ubo.*;
import com.github.hydos.ginger.engine.vulkan.render.ubo.UboDescriptor;
import com.github.hydos.ginger.engine.vulkan.shaders.Pipeline; import com.github.hydos.ginger.engine.vulkan.shaders.Pipeline;
import com.github.hydos.ginger.engine.vulkan.utils.VKDeviceProperties; import com.github.hydos.ginger.engine.vulkan.utils.*;
import com.github.hydos.ginger.engine.vulkan.utils.VKLoader;
import com.github.hydos.ginger.engine.vulkan.utils.VKUtils;
/** /**
* *
* @author hydos06 * @author hydos06

View File

@ -6,11 +6,12 @@ import java.util.*;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.*; import org.lwjgl.opengl.*;
import com.github.halotroop.litecraft.types.block.*;
import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.opengl.render.models.RawModel; import com.github.hydos.ginger.engine.opengl.render.models.RawModel;
import com.github.hydos.ginger.engine.opengl.render.texture.*; import com.github.hydos.ginger.engine.opengl.render.texture.Image;
public class GLLoader public class GlLoader
{ {
private static List<Integer> vaos = new ArrayList<Integer>(); private static List<Integer> vaos = new ArrayList<Integer>();
private static List<Integer> vbos = new ArrayList<Integer>(); private static List<Integer> vbos = new ArrayList<Integer>();
@ -101,6 +102,46 @@ public class GLLoader
public static int loadTexture(String path) public static int loadTexture(String path)
{ return loadTextureDirectly("/textures/" + path); } { return loadTextureDirectly("/textures/" + path); }
public static int createBlockAtlas()
{
int width = 16;
int height = 16;
//Prepare the atlas texture and gen it
int atlasId = GL40.glGenTextures();
//Bind it to openGL
GL40.glBindTexture(GL40.GL_TEXTURE_2D, atlasId);
//Apply the settings for the texture
GL40.glTexParameteri(GL40.GL_TEXTURE_2D, GL40.GL_TEXTURE_MIN_FILTER, GL40.GL_NEAREST);
GL40.glTexParameteri(GL40.GL_TEXTURE_2D, GL40.GL_TEXTURE_MAG_FILTER, GL40.GL_NEAREST);
//Fill the image with blank image data
GL40.glTexImage2D(GL40.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width*2, height*2, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
long maxX = Math.round(Math.sqrt(Blocks.blocks.size()));
int currentX = 0;
int currentY = 0;
for(Block block: Blocks.blocks) {
//just in case
if(!block.texture.equals("DONTLOAD")) {
System.out.println(block.texture);
block.updateBlockModelData();
if(currentX > maxX) {
currentX = 0;
currentY--;
}
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0,
currentX*width, currentY*height,
width, height,
GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE,
block.model.getTexture().getTexture().getImage()
);
currentX++;
}
}
return atlasId;
}
public static int loadTextureDirectly(String path) public static int loadTextureDirectly(String path)
{ {
int textureID = GL11.glGenTextures(); int textureID = GL11.glGenTextures();

View File

@ -1,33 +1,13 @@
package com.github.hydos.ginger.engine.vulkan.render.ubo; package com.github.hydos.ginger.engine.vulkan.render.ubo;
import static org.lwjgl.system.MemoryUtil.memAllocInt; import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryUtil.memAllocLong; import static org.lwjgl.vulkan.VK10.*;
import static org.lwjgl.system.MemoryUtil.memAllocPointer;
import static org.lwjgl.system.MemoryUtil.memByteBuffer;
import static org.lwjgl.system.MemoryUtil.memFree;
import static org.lwjgl.vulkan.VK10.VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
import static org.lwjgl.vulkan.VK10.VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_SUCCESS;
import static org.lwjgl.vulkan.VK10.vkAllocateMemory;
import static org.lwjgl.vulkan.VK10.vkBindBufferMemory;
import static org.lwjgl.vulkan.VK10.vkCreateBuffer;
import static org.lwjgl.vulkan.VK10.vkGetBufferMemoryRequirements;
import static org.lwjgl.vulkan.VK10.vkMapMemory;
import static org.lwjgl.vulkan.VK10.vkUnmapMemory;
import java.nio.ByteBuffer; import java.nio.*;
import java.nio.IntBuffer;
import java.nio.LongBuffer;
import org.joml.Matrix4f; import org.joml.Matrix4f;
import org.lwjgl.PointerBuffer; import org.lwjgl.PointerBuffer;
import org.lwjgl.vulkan.VkBufferCreateInfo; import org.lwjgl.vulkan.*;
import org.lwjgl.vulkan.VkDevice;
import org.lwjgl.vulkan.VkMemoryAllocateInfo;
import org.lwjgl.vulkan.VkMemoryRequirements;
import org.lwjgl.vulkan.VkPhysicalDeviceMemoryProperties;
import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.vulkan.memory.VKMemory; import com.github.hydos.ginger.engine.vulkan.memory.VKMemory;

View File

@ -1,51 +1,12 @@
package com.github.hydos.ginger.engine.vulkan.shaders; package com.github.hydos.ginger.engine.vulkan.shaders;
import static org.lwjgl.system.MemoryUtil.memAllocInt; import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryUtil.memAllocLong; import static org.lwjgl.vulkan.VK10.*;
import static org.lwjgl.system.MemoryUtil.memFree;
import static org.lwjgl.vulkan.VK10.VK_COMPARE_OP_ALWAYS;
import static org.lwjgl.vulkan.VK10.VK_COMPARE_OP_LESS_OR_EQUAL;
import static org.lwjgl.vulkan.VK10.VK_CULL_MODE_NONE;
import static org.lwjgl.vulkan.VK10.VK_DYNAMIC_STATE_SCISSOR;
import static org.lwjgl.vulkan.VK10.VK_DYNAMIC_STATE_VIEWPORT;
import static org.lwjgl.vulkan.VK10.VK_FRONT_FACE_COUNTER_CLOCKWISE;
import static org.lwjgl.vulkan.VK10.VK_NULL_HANDLE;
import static org.lwjgl.vulkan.VK10.VK_POLYGON_MODE_FILL;
import static org.lwjgl.vulkan.VK10.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
import static org.lwjgl.vulkan.VK10.VK_SAMPLE_COUNT_1_BIT;
import static org.lwjgl.vulkan.VK10.VK_SHADER_STAGE_FRAGMENT_BIT;
import static org.lwjgl.vulkan.VK10.VK_SHADER_STAGE_VERTEX_BIT;
import static org.lwjgl.vulkan.VK10.VK_STENCIL_OP_KEEP;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_SUCCESS;
import static org.lwjgl.vulkan.VK10.vkCreateGraphicsPipelines;
import static org.lwjgl.vulkan.VK10.vkCreatePipelineLayout;
import java.io.IOException; import java.io.IOException;
import java.nio.IntBuffer; import java.nio.*;
import java.nio.LongBuffer;
import org.lwjgl.vulkan.VkDevice; import org.lwjgl.vulkan.*;
import org.lwjgl.vulkan.VkGraphicsPipelineCreateInfo;
import org.lwjgl.vulkan.VkPipelineColorBlendAttachmentState;
import org.lwjgl.vulkan.VkPipelineColorBlendStateCreateInfo;
import org.lwjgl.vulkan.VkPipelineDepthStencilStateCreateInfo;
import org.lwjgl.vulkan.VkPipelineDynamicStateCreateInfo;
import org.lwjgl.vulkan.VkPipelineInputAssemblyStateCreateInfo;
import org.lwjgl.vulkan.VkPipelineLayoutCreateInfo;
import org.lwjgl.vulkan.VkPipelineMultisampleStateCreateInfo;
import org.lwjgl.vulkan.VkPipelineRasterizationStateCreateInfo;
import org.lwjgl.vulkan.VkPipelineShaderStageCreateInfo;
import org.lwjgl.vulkan.VkPipelineVertexInputStateCreateInfo;
import org.lwjgl.vulkan.VkPipelineViewportStateCreateInfo;
import com.github.hydos.ginger.engine.vulkan.utils.VKUtils; import com.github.hydos.ginger.engine.vulkan.utils.VKUtils;

View File

@ -1,20 +1,12 @@
package com.github.hydos.ginger.engine.vulkan.shaders; package com.github.hydos.ginger.engine.vulkan.shaders;
import static org.lwjgl.system.MemoryUtil.memAllocLong; import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryUtil.memFree; import static org.lwjgl.vulkan.VK10.*;
import static org.lwjgl.system.MemoryUtil.memUTF8;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
import static org.lwjgl.vulkan.VK10.VK_SUCCESS;
import static org.lwjgl.vulkan.VK10.vkCreateShaderModule;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.*;
import java.nio.LongBuffer;
import org.lwjgl.vulkan.VkDevice; import org.lwjgl.vulkan.*;
import org.lwjgl.vulkan.VkPipelineShaderStageCreateInfo;
import org.lwjgl.vulkan.VkShaderModuleCreateInfo;
import com.github.hydos.ginger.engine.vulkan.utils.VKUtils; import com.github.hydos.ginger.engine.vulkan.utils.VKUtils;

View File

@ -1,25 +1,12 @@
package com.github.hydos.ginger.engine.vulkan.utils; package com.github.hydos.ginger.engine.vulkan.utils;
import static org.lwjgl.system.MemoryUtil.memAllocFloat; import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryUtil.memAllocInt;
import static org.lwjgl.system.MemoryUtil.memAllocPointer;
import static org.lwjgl.system.MemoryUtil.memFree;
import static org.lwjgl.system.MemoryUtil.memUTF8;
import static org.lwjgl.vulkan.KHRSwapchain.VK_KHR_SWAPCHAIN_EXTENSION_NAME; import static org.lwjgl.vulkan.KHRSwapchain.VK_KHR_SWAPCHAIN_EXTENSION_NAME;
import java.nio.ByteBuffer; import java.nio.*;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.PointerBuffer; import org.lwjgl.PointerBuffer;
import org.lwjgl.vulkan.VK12; import org.lwjgl.vulkan.*;
import org.lwjgl.vulkan.VkDevice;
import org.lwjgl.vulkan.VkDeviceCreateInfo;
import org.lwjgl.vulkan.VkDeviceQueueCreateInfo;
import org.lwjgl.vulkan.VkInstance;
import org.lwjgl.vulkan.VkPhysicalDevice;
import org.lwjgl.vulkan.VkPhysicalDeviceMemoryProperties;
import org.lwjgl.vulkan.VkQueueFamilyProperties;
import com.github.hydos.ginger.engine.vulkan.VKConstants; import com.github.hydos.ginger.engine.vulkan.VKConstants;

View File

@ -1,59 +1,17 @@
package com.github.hydos.ginger.engine.vulkan.utils; package com.github.hydos.ginger.engine.vulkan.utils;
import static org.lwjgl.system.MemoryUtil.memAllocLong; import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryUtil.memAllocPointer; import static org.lwjgl.util.shaderc.Shaderc.*;
import static org.lwjgl.system.MemoryUtil.memFree; import static org.lwjgl.vulkan.EXTDebugReport.*;
import static org.lwjgl.system.MemoryUtil.memUTF8; import static org.lwjgl.vulkan.KHRSurface.*;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_anyhit_shader;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_closesthit_shader;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_compilation_status_success;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_compile_into_spv;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_compile_options_initialize;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_compile_options_set_include_callbacks;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_compile_options_set_optimization_level;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_compiler_initialize;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_compiler_release;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_fragment_shader;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_miss_shader;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_optimization_level_performance;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_raygen_shader;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_result_get_bytes;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_result_get_compilation_status;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_result_get_error_message;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_result_get_length;
import static org.lwjgl.util.shaderc.Shaderc.shaderc_vertex_shader;
import static org.lwjgl.vulkan.EXTDebugReport.VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
import static org.lwjgl.vulkan.EXTDebugReport.vkCreateDebugReportCallbackEXT;
import static org.lwjgl.vulkan.KHRSurface.VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
import static org.lwjgl.vulkan.KHRSurface.VK_ERROR_SURFACE_LOST_KHR;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.*;
import java.nio.LongBuffer;
import org.lwjgl.BufferUtils; import org.lwjgl.*;
import org.lwjgl.PointerBuffer;
import org.lwjgl.system.MemoryStack; import org.lwjgl.system.MemoryStack;
import org.lwjgl.util.shaderc.ShadercIncludeResolve; import org.lwjgl.util.shaderc.*;
import org.lwjgl.util.shaderc.ShadercIncludeResult; import org.lwjgl.vulkan.*;
import org.lwjgl.util.shaderc.ShadercIncludeResultRelease;
import org.lwjgl.vulkan.EXTDebugReport;
import org.lwjgl.vulkan.KHRDisplaySwapchain;
import org.lwjgl.vulkan.KHRSwapchain;
import org.lwjgl.vulkan.NVRayTracing;
import org.lwjgl.vulkan.VK10;
import org.lwjgl.vulkan.VK12;
import org.lwjgl.vulkan.VkClearValue;
import org.lwjgl.vulkan.VkCommandBuffer;
import org.lwjgl.vulkan.VkCommandBufferAllocateInfo;
import org.lwjgl.vulkan.VkCommandBufferBeginInfo;
import org.lwjgl.vulkan.VkDebugReportCallbackCreateInfoEXT;
import org.lwjgl.vulkan.VkDebugReportCallbackEXT;
import org.lwjgl.vulkan.VkDevice;
import org.lwjgl.vulkan.VkInstance;
import org.lwjgl.vulkan.VkRect2D;
import org.lwjgl.vulkan.VkRenderPassBeginInfo;
import org.lwjgl.vulkan.VkViewport;
import com.github.hydos.ginger.engine.common.tools.IOUtil; import com.github.hydos.ginger.engine.common.tools.IOUtil;
import com.github.hydos.ginger.engine.vulkan.VKConstants; import com.github.hydos.ginger.engine.vulkan.VKConstants;

View File

@ -1,14 +1,7 @@
package tk.valoeghese.sod; package tk.valoeghese.sod;
import java.io.DataInputStream; import java.io.*;
import java.io.DataOutputStream; import java.util.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import tk.valoeghese.sod.exception.SODParseException; import tk.valoeghese.sod.exception.SODParseException;

View File

@ -2,8 +2,7 @@ package tk.valoeghese.sod;
import java.util.Iterator; import java.util.Iterator;
import it.unimi.dsi.fastutil.bytes.ByteArrayList; import it.unimi.dsi.fastutil.bytes.*;
import it.unimi.dsi.fastutil.bytes.ByteList;
public class ByteArrayDataSection implements BaseDataSection<Byte> { public class ByteArrayDataSection implements BaseDataSection<Byte> {
public ByteArrayDataSection() { public ByteArrayDataSection() {

View File

@ -1,8 +1,6 @@
package tk.valoeghese.sod; package tk.valoeghese.sod;
import java.util.ArrayList; import java.util.*;
import java.util.Iterator;
import java.util.List;
/** /**
* Represents a section of SOD data. * Represents a section of SOD data.

View File

@ -2,8 +2,7 @@ package tk.valoeghese.sod;
import java.util.Iterator; import java.util.Iterator;
import it.unimi.dsi.fastutil.doubles.DoubleArrayList; import it.unimi.dsi.fastutil.doubles.*;
import it.unimi.dsi.fastutil.doubles.DoubleList;
public class DoubleArrayDataSection implements BaseDataSection<Double> { public class DoubleArrayDataSection implements BaseDataSection<Double> {
public DoubleArrayDataSection() { public DoubleArrayDataSection() {

View File

@ -2,8 +2,7 @@ package tk.valoeghese.sod;
import java.util.Iterator; import java.util.Iterator;
import it.unimi.dsi.fastutil.floats.FloatArrayList; import it.unimi.dsi.fastutil.floats.*;
import it.unimi.dsi.fastutil.floats.FloatList;
public class FloatArrayDataSection implements BaseDataSection<Float> { public class FloatArrayDataSection implements BaseDataSection<Float> {
public FloatArrayDataSection() { public FloatArrayDataSection() {

View File

@ -2,8 +2,7 @@ package tk.valoeghese.sod;
import java.util.Iterator; import java.util.Iterator;
import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.*;
import it.unimi.dsi.fastutil.ints.IntList;
public class IntArrayDataSection implements BaseDataSection<Integer> { public class IntArrayDataSection implements BaseDataSection<Integer> {
public IntArrayDataSection() { public IntArrayDataSection() {

View File

@ -2,8 +2,7 @@ package tk.valoeghese.sod;
import java.util.Iterator; import java.util.Iterator;
import it.unimi.dsi.fastutil.longs.LongArrayList; import it.unimi.dsi.fastutil.longs.*;
import it.unimi.dsi.fastutil.longs.LongList;
public class LongArrayDataSection implements BaseDataSection<Long> { public class LongArrayDataSection implements BaseDataSection<Long> {
public LongArrayDataSection() { public LongArrayDataSection() {

View File

@ -1,10 +1,7 @@
package tk.valoeghese.sod; package tk.valoeghese.sod;
import java.io.DataInputStream; import java.io.*;
import java.io.DataOutputStream; import java.util.*;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import tk.valoeghese.sod.exception.SODParseException; import tk.valoeghese.sod.exception.SODParseException;

View File

@ -2,8 +2,7 @@ package tk.valoeghese.sod;
import java.util.Iterator; import java.util.Iterator;
import it.unimi.dsi.fastutil.shorts.ShortArrayList; import it.unimi.dsi.fastutil.shorts.*;
import it.unimi.dsi.fastutil.shorts.ShortList;
public class ShortArrayDataSection implements BaseDataSection<Short> { public class ShortArrayDataSection implements BaseDataSection<Short> {
public ShortArrayDataSection() { public ShortArrayDataSection() {

View File

@ -1,8 +1,6 @@
package tk.valoeghese.sod; package tk.valoeghese.sod;
import java.util.ArrayList; import java.util.*;
import java.util.Iterator;
import java.util.List;
public class StringArrayDataSection implements BaseDataSection<String> { public class StringArrayDataSection implements BaseDataSection<String> {
public StringArrayDataSection() { public StringArrayDataSection() {

View File

@ -1,7 +1,6 @@
package tk.valoeghese.sod; package tk.valoeghese.sod;
import java.io.File; import java.io.*;
import java.io.IOException;
class TestMain { class TestMain {