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
for (uint32 FaceIndex = 0; FaceIndex < 6; ++FaceIndex) | |
{ | |
TArray<uint16> NewIndices; | |
// Only draw faces that face empty bricks. | |
const int32 FacingLocalBrickX = LocalBrickX + FaceNormals[FaceIndex].X; | |
const int32 FacingLocalBrickY = LocalBrickY + FaceNormals[FaceIndex].Y; | |
const int32 FacingLocalBrickZ = LocalBrickZ + FaceNormals[FaceIndex].Z; | |
const uint32 FacingLocalBrickIndex = (FacingLocalBrickY * LocalBricksDim.X + FacingLocalBrickX) * LocalBricksDim.Z + FacingLocalBrickZ; | |
const uint32 FrontBrickMaterial = LocalBrickMaterials[FacingLocalBrickIndex]; |
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
#pragma once | |
#include <DynamicMeshBuilder.h> | |
#include "BrickGridComponent.h" | |
class ComplexShapeBrickFactory | |
{ | |
public: | |
ComplexShapeBrickFactory() |
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
void UBrickStairsRenderer::Render(TArray<uint16>& VertexIndexMap, TArray<FDynamicMeshVertex>& Vertices, TArray<FMaterialBatch>& MaterialBatches, TArray<uint16> NewIndices, int FaceIndex) | |
{ | |
int Offset = 0; | |
FFaceBatch& FaceBatch = MaterialBatches[9].FaceBatches[FaceIndex]; | |
uint16* FaceVertexIndex; | |
//Tall stair step | |
for (uint32 FaceVertexIndex = 0; FaceVertexIndex < 4; ++FaceVertexIndex) | |
{ | |
const int VertexIndex = NewIndices[FaceVertexIndex]; |
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
void UBrickStairsRenderer::Render(TArray<uint16>& VertexIndexMap, TArray<FDynamicMeshVertex>& Vertices, TArray<FMaterialBatch>& MaterialBatches, TArray<uint16> NewIndices, int FaceIndex) | |
{ | |
int Offset = 0; | |
FFaceBatch& FaceBatch = MaterialBatches[9].FaceBatches[FaceIndex]; | |
uint16* FaceVertexIndex; | |
//Tall stair step | |
for (uint32 FaceVertexIndex = 0; FaceVertexIndex < 4; ++FaceVertexIndex) | |
{ | |
const int VertexIndex = NewIndices[FaceVertexIndex]; |
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
void UBrickStairsRenderer::Render(TArray<uint16>& VertexIndexMap, TArray<FDynamicMeshVertex>& Vertices, TArray<FMaterialBatch>& MaterialBatches, TArray<uint16> NewIndices, int FaceIndex) | |
{ | |
int Offset = 0; | |
FFaceBatch& FaceBatch = MaterialBatches[9].FaceBatches[FaceIndex]; | |
uint16* FaceVertexIndex; | |
//Tall stair step | |
for (uint32 FaceVertexIndex = 0; FaceVertexIndex < 4; ++FaceVertexIndex) | |
{ | |
const int VertexIndex = NewIndices[FaceVertexIndex]; | |
const FVector Position = Vertices[VertexIndex].Position; |
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
void UBrickStairsRenderer::Render(TArray<uint16>& VertexIndexMap, TArray<FDynamicMeshVertex>& Vertices, TArray<FMaterialBatch>& MaterialBatches, TArray<uint16> NewIndices, int FaceIndex) | |
{ | |
int Offset = 0; | |
for (int ammountOfTimes = 1; ammountOfTimes <= 3; ++ammountOfTimes) | |
{ | |
for (uint32 FaceVertexIndex = 0; FaceVertexIndex < 4; ++FaceVertexIndex) | |
{ | |
const int VertexIndex = NewIndices[FaceVertexIndex]; | |
const FVector Position = Vertices[VertexIndex].Position; | |
int NewVertexIndex = Vertices.Num(); |
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
void UBrickGridComponent::UpdateMaxNonEmptyBrickMap(FBrickRegion& Region, const FInt3 MinDirtyRegionBrickCoordinates, const FInt3 MaxDirtyRegionBrickCoordinates) const | |
{ | |
// Allocate the map. | |
if (!Region.MaxNonEmptyBrickRegionZs.Num()) | |
{ | |
Region.MaxNonEmptyBrickRegionZs.SetNumUninitialized(1 << (Parameters.BricksPerRegionLog2.X + Parameters.BricksPerRegionLog2.Y)); | |
} | |
// For each XY in the chunk, find the highest non-empty brick between the bottom of the chunk and the top of the grid. |
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
FVoxelRegion& Region = *new(Regions) FVoxelRegion; | |
Region.Coordinates = RegionCoordinates; | |
// Initialize the region's Voxels to the empty material. | |
Region.VoxelContents.Init(Parameters.EmptyMaterialIndex, 1 << Parameters.VoxelsPerRegionLog2.SumComponents()); | |
// Compute the region's non-empty height map. | |
UpdateMaxNonEmptyVoxelMap(Region, FInt3::Scalar(0), VoxelsPerRegion - FInt3::Scalar(1)); |
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
void UVoxelLandscapeComponent::GetRegionComplexVoxelsCoordinates(const FInt3 RegionCoordinates, TArray<FInt3> &outCoordinates, TArray<uint8> &outComplexVoxelIndices) | |
{ | |
const int32* const RegionIndex = RegionCoordinatesToIndex.Find(RegionCoordinates); | |
if (RegionIndex)// && RegionCoordinates == FInt3(0, 0, 0)) | |
{ | |
UpdateRegionComplexVoxelsMap(Regions[*RegionIndex], FInt3::Scalar(0), VoxelsPerRegion - FInt3::Scalar(1)); | |
Regions[*RegionIndex].RegionComplexVoxelsIndexes.GenerateKeyArray(outCoordinates); | |
Regions[*RegionIndex].RegionComplexVoxelsIndexes.GenerateValueArray(outComplexVoxelIndices); | |
for (FInt3 Coordinates : outCoordinates) | |
{ |
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
#!/bin/python | |
from __future__ import print_function | |
import os | |
import sys | |
# | |
# Complete the diagonalDifference function below. |
OlderNewer