This file contains hidden or 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
void FVulkanScreenGrab::ScreenshotDepth(FVulkanDevice vulkanDevice, FVulkanSwapChain swapChain, VkCommandPool commandPool, VkQueue queue, VkImage srcImage, const char* filename) | |
{ | |
// Get format properties for the swapchain color format | |
VkFormatProperties formatProps; | |
auto depthFormat = FVulkanCalculator::FindDepthFormat(vulkanDevice.physicalDevice); | |
// Check if the device supports blitting from optimal images (the swapchain images are in optimal format) | |
vkGetPhysicalDeviceFormatProperties(vulkanDevice.physicalDevice, depthFormat, &formatProps); | |
if (!(formatProps.optimalTilingFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR)) | |
{ |
This file contains hidden or 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
void FVulkanApplication::CreateRenderPass() | |
{ | |
VkAttachmentDescription colorAttachment = {}; | |
colorAttachment.format = swapChain.colorFormat; | |
colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT; | |
colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; | |
colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; | |
colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; | |
colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; | |
colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; |
This file contains hidden or 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
void FVulkanApplication::CreateDepthResources() | |
{ | |
VkFormat depthFormat = FVulkanCalculator::FindDepthFormat(vulkanDevice.physicalDevice); | |
FVulkanImageCalculator::CreateImage(vulkanDevice, swapChain.extent.width, swapChain.extent.height, depthFormat, | |
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, | |
depthImage, depthImageMemory); | |
depthImageView = FVulkanFactory::ImageView(vulkanDevice.logicalDevice, depthImage, depthFormat, VK_IMAGE_ASPECT_DEPTH_BIT); | |
FVulkanImageCalculator::TransitionImageLayout( | |
vulkanDevice.logicalDevice, commandPool, graphicsQueue, | |
depthImage, depthFormat, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); |
This file contains hidden or 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
void FVulkanApplication::CreateDepthResources() | |
{ | |
VkFormat depthFormat = FVulkanCalculator::FindDepthFormat(vulkanDevice.physicalDevice); | |
FVulkanImageCalculator::CreateImage(vulkanDevice, swapChain.extent.width, swapChain.extent.height, depthFormat, | |
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, | |
depthImage, depthImageMemory); | |
depthImageView = FVulkanFactory::ImageView(vulkanDevice.logicalDevice, depthImage, depthFormat, VK_IMAGE_ASPECT_DEPTH_BIT); | |
FVulkanImageCalculator::TransitionImageLayout( | |
vulkanDevice.logicalDevice, commandPool, graphicsQueue, | |
depthImage, depthFormat, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); |
This file contains hidden or 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
using UnityEngine; | |
using System.Collections.Generic; | |
public class Tile : MonoBehaviour { | |
public Tile pathParent; | |
public int gScore; | |
public int fScore; | |
public List<Tile> neighbors = new List<Tile>(); | |
} |
This file contains hidden or 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
using UnityEngine; | |
using System.Collections.Generic; | |
public class Search : MonoBehaviour | |
{ | |
int gridSize = 10; | |
void Start() | |
{ | |
Tile[,] tiles = new Tile[gridSize, gridSize]; | |
for (int x = 0; x < gridSize; x++) |
This file contains hidden or 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
using UnityEngine; | |
using System.Collections.Generic; | |
[RequireComponent(typeof(MeshRenderer))] | |
[RequireComponent(typeof(MeshFilter))] | |
public class GridMesh : MonoBehaviour | |
{ | |
public int GridSize; | |
void Awake() |