Add API Geometry Config

This commit is contained in:
James Seibel
2022-07-02 22:42:17 -05:00
parent e0947d3490
commit 32fd3b6084
5 changed files with 162 additions and 9 deletions
@@ -0,0 +1,39 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.api.external.apiObjects.enums;
/**
* CONSTANT <br>
* FREQUENT <br>
* NORMAL <br>
* RARE <br> <br>
*
* Determines how fast the buffers should be regenerated
*
* @author Leonardo Amato
* @version 9-25-2021
*/
public enum EDhApiBufferRebuildTimes
{
CONSTANT,
FREQUENT,
NORMAL,
RARE;
}
@@ -0,0 +1,64 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.api.external.apiObjects.enums;
/**
* AUTO, <br>
* BUFFER_STORAGE, <br>
* SUB_DATA, <br>
* BUFFER_MAPPING, <br>
* DATA <br>
*
* @author Leetom
* @author James Seibel
* @version 2022-7-2
*/
public enum EDhApiGpuUploadMethod
{
/** Picks the best option based on the GPU the user has. */
AUTO,
/**
* Default for NVIDIA if OpenGL 4.5 is supported. <br>
* Fast rendering, no stuttering.
*/
BUFFER_STORAGE,
/**
* Backup option for NVIDIA. <br>
* Fast rendering but may stutter when uploading.
*/
SUB_DATA,
/**
* Default option for AMD/Intel. <br>
* May end up storing buffers in System memory. <br>
* Fast rending if in GPU memory, slow if in system memory, <br>
* but won't stutter when uploading.
*/
BUFFER_MAPPING,
/**
* Backup option for AMD/Intel. <br>
* Fast rendering but may stutter when uploading.
*/
DATA;
}
@@ -0,0 +1,45 @@
package com.seibel.lod.core.api.external.config.client;
import com.seibel.lod.core.api.external.apiObjects.enums.EDhApiBufferRebuildTimes;
import com.seibel.lod.core.api.external.apiObjects.enums.EDhApiGpuUploadMethod;
import com.seibel.lod.core.api.external.apiObjects.wrapperInterfaces.IDhApiConfig;
import com.seibel.lod.core.api.implementation.objects.GenericEnumConverter;
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
import com.seibel.lod.core.config.Config.Client.Advanced.Buffers;
import com.seibel.lod.core.enums.config.EBufferRebuildTimes;
import com.seibel.lod.core.enums.config.EGpuUploadMethod;
/**
* General Threading settings.
*
* @author James Seibel
* @version 2022-6-13
*/
public class DhApiGeometry
{
/**
* Returns the config related to how geometry data is
* uploaded to the GPU.
*/
public static IDhApiConfig<EDhApiGpuUploadMethod> getGpuUploadMethodConfig()
{ return new DhApiConfig<>(Buffers.gpuUploadMethod, new GenericEnumConverter<>(EGpuUploadMethod.class, EDhApiGpuUploadMethod.class)); }
/**
* Returns the config related to how long we should wait after
* uploading one Megabyte of geometry data to the GPU before uploading
* the next Megabyte of data.
*/
public static IDhApiConfig<Integer> getBufferUploadTimeoutPerMegabyteInMillisecondsConfig()
{ return new DhApiConfig<>(Buffers.gpuUploadPerMegabyteInMilliseconds); }
/**
* Returns the config related to how long we should wait after
* uploading one Megabyte of geometry data to the GPU before uploading
* the next Megabyte of data.
*/
public static IDhApiConfig<EDhApiBufferRebuildTimes> getBufferRebuildTimeConfig()
{ return new DhApiConfig<>(Buffers.rebuildTimes, new GenericEnumConverter<>(EBufferRebuildTimes.class, EDhApiBufferRebuildTimes.class)); }
}
@@ -20,11 +20,12 @@
package com.seibel.lod.core.enums.config;
/**
* CONSTANT <br>
* FREQUENT <br>
* NORMAL <br>
* RARE <br>
* <br>
* Determines how fast the buffers need to be regenerated
* RARE <br> <br>
*
* Determines how fast the buffers should be regenerated
*
* @author Leonardo Amato
* @version 9-25-2021
@@ -20,19 +20,23 @@
package com.seibel.lod.core.enums.config;
/**
* Auto, BUFFER_STORAGE_MAPPING, Buffer_Storage, Sub_Data, Buffer_Mapping, Data
*
* AUTO, <br>
* BUFFER_STORAGE, <br>
* SUB_DATA, <br>
* BUFFER_MAPPING, <br>
* DATA <br>
*
* @author Leetom
* @author James Seibel
* @version 12-1-2021
* @version 2022-7-2
*/
public enum EGpuUploadMethod
{
/** Picks the best option based on the GPU the user has. */
AUTO(false, false),
/*
*/
BUFFER_STORAGE_MAPPING(true, true),
// commented out since it isn't currently in use
//BUFFER_STORAGE_MAPPING(true, true),
/**
* Default for NVIDIA if OpenGL 4.5 is supported. <br>