Skip to content

Commit

Permalink
Update to 1.19.0-pre.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tyronx committed Oct 28, 2023
1 parent ae41df5 commit b6532b4
Show file tree
Hide file tree
Showing 444 changed files with 5,962 additions and 4,833 deletions.
8 changes: 1 addition & 7 deletions Client/API/IAmbientManager.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vintagestory.API.Common;
using Vintagestory.API.Datastructures;
using Vintagestory.API.Datastructures;
using Vintagestory.API.MathTools;

namespace Vintagestory.API.Common
Expand Down
2 changes: 0 additions & 2 deletions Client/API/IClientPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Vintagestory.API.Common;
using Vintagestory.API.Common.Entities;
using Vintagestory.API.MathTools;

namespace Vintagestory.API.Client
{
Expand Down
4 changes: 3 additions & 1 deletion Client/API/IClientWorldAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ public interface IClientWorldAccessor : IWorldAccessor
/// The internal cache of all currently loaded entities. Warning: You should not set or remove anything from this dic unless you *really* know what you're doing. Use SpawnEntity/DespawnEntity instead.
/// </summary>
Dictionary<long, Entity> LoadedEntities { get; }


Dictionary<int, IMiniDimension> Dimensions { get; }
IMiniDimension GetOrCreateDimension(int dimId, Vec3d pos);
bool TryGetMiniDimension(Vec3i origin, out IMiniDimension dimension);
}
}
4 changes: 0 additions & 4 deletions Client/API/ICoreClientAPI.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using Vintagestory.API;
using Vintagestory.API.Common;
using Vintagestory.API.Datastructures;
using Vintagestory.API.MathTools;
using static Vintagestory.API.Common.VtmlUtil;

namespace Vintagestory.API.Client
{
Expand Down
4 changes: 0 additions & 4 deletions Client/API/IGuiAPI.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using Cairo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vintagestory.API.Common;
using Vintagestory.API.MathTools;

Expand Down
3 changes: 1 addition & 2 deletions Client/API/IInputAPI.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using OpenTK.Windowing.GraphicsLibraryFramework;
using Vintagestory.API.Common;
using Vintagestory.API.Common;
using Vintagestory.API.Datastructures;

namespace Vintagestory.API.Client
Expand Down
41 changes: 31 additions & 10 deletions Client/API/IRenderAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,20 @@ public interface IRenderAPI
/// </summary>
StackMatrix4 PMatrix { get; }

/// <summary>
/// Returns you a render info object of given item stack. Can be used to render held items onto a creature.
/// </summary>
/// <param name="itemstack"></param>
/// <param name="ground"></param>
/// <returns></returns>
[Obsolete("Use GetItemStackRenderInfo(inSlot, ...) instead")]
ItemRenderInfo GetItemStackRenderInfo(ItemStack itemstack, EnumItemRenderTarget ground);

/// <summary>
/// Returns you a render info object of given item stack. Can be used to render held items onto a creature.
/// </summary>
/// <param name="inSlot"></param>
/// <param name="ground"></param>
/// <returns></returns>
ItemRenderInfo GetItemStackRenderInfo(ItemSlot inSlot, EnumItemRenderTarget ground);
ItemRenderInfo GetItemStackRenderInfo(ItemSlot inSlot, EnumItemRenderTarget ground, float dt);

This comment has been minimized.

Copy link
@maltiez2

maltiez2 Oct 28, 2023

@tyronx
Please add a default value to float dt

This comment has been minimized.

Copy link
@tyronx

tyronx Nov 2, 2023

Author Contributor

for what purpose?



#region OpenGL

void Reset3DProjection();
void Set3DProjection(float zfar, float fov);

/// <summary>
/// Returns null if no OpenGL Error happened, otherwise one of the official opengl error codes
/// </summary>
Expand Down Expand Up @@ -473,6 +468,13 @@ float[] CurrentShadowProjectionMatrix
/// <returns></returns>
MeshRef UploadMesh(MeshData data);

/// <summary>
/// Same as <seealso cref="UploadMesh(MeshData)"/> but splits it into multiple MeshRefs, one for each texture
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
MultiTextureMeshRef UploadMultiTextureMesh(MeshData data);

/// <summary>
/// Updates the existing mesh. Updates any non null data from <paramref name="updatedata"/>
/// </summary>
Expand All @@ -488,6 +490,10 @@ float[] CurrentShadowProjectionMatrix

#endregion





#region Render

/// <summary>
Expand All @@ -496,6 +502,21 @@ float[] CurrentShadowProjectionMatrix
/// <param name="meshRef"></param>
void RenderMesh(MeshRef meshRef);

/// <summary>
/// Renders given mesh onto the screen, with the mesh requiring multiple render calls for each texture, asigns the associated texture each call
/// </summary>
/// <param name="mmr"></param>
/// <param name="textureSampleName"></param>
void RenderMultiTextureMesh(MultiTextureMeshRef mmr, string textureSampleName, int textureNumber = 0);

/// <summary>
/// Renders given mesh onto the screen, with the mesh requiring multiple render calls for each texture, does not asign any texture
/// </summary>
/// <param name="mmr"></param>
/// <param name="textureSampleName"></param>
void RenderMultiTextureMesh(MultiTextureMeshRef mmr);


/// <summary>
/// Uses the graphics instanced rendering methods to efficiently render the same mesh multiple times. Use the custom mesh data parts with instanced flag on to supply custom data to each mesh.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion Client/API/IRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Vintagestory.API.Common;

namespace Vintagestory.API.Client
{
Expand Down
6 changes: 1 addition & 5 deletions Client/API/ISettings.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace Vintagestory.API.Client
{
Expand Down
23 changes: 19 additions & 4 deletions Client/API/ITesselatorAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TesselationMetaData

public int GeneralWindMode;

public bool usesColorMap; // bubble up var
public bool UsesColorMap; // bubble up var
public int[] defaultTextureSize;

public TesselationMetaData Clone()
Expand All @@ -38,7 +38,7 @@ public TesselationMetaData Clone()
TexturesSizes = TexturesSizes,
TypeForLogging = TypeForLogging,
WithJointIds = WithJointIds,
usesColorMap = usesColorMap,
UsesColorMap = UsesColorMap,
defaultTextureSize = defaultTextureSize,
GeneralWindMode = GeneralWindMode,
WithDamageEffect = WithDamageEffect,
Expand Down Expand Up @@ -66,14 +66,14 @@ public interface ITesselatorManager
/// </summary>
/// <param name="block"></param>
/// <returns></returns>
MeshRef GetDefaultBlockMeshRef(Block block);
MultiTextureMeshRef GetDefaultBlockMeshRef(Block block);

/// <summary>
/// Returns the default block mesh ref that being used by the engine when rendering an item in the inventory. The alternate and inventory versions are seperate.
/// </summary>
/// <param name="block"></param>
/// <returns></returns>
MeshRef GetDefaultItemMeshRef(Item block);
MultiTextureMeshRef GetDefaultItemMeshRef(Item block);

Shape GetCachedShape(AssetLocation location);
void ThreadDispose();
Expand Down Expand Up @@ -131,6 +131,21 @@ public interface ITesselatorAPI
/// <param name="texSource"></param>
void TesselateItem(Item item, out MeshData modeldata, ITexPositionSource texSource);

/// <summary>
/// Tesselate a shape based on its composite shape file
/// </summary>
/// <param name="type"></param>
/// <param name="name"></param>
/// <param name="compositeShape"></param>
/// <param name="modeldata"></param>
/// <param name="texSource"></param>
/// <param name="generalGlowLevel"></param>
/// <param name="climateColorMapIndex"></param>
/// <param name="seasonColorMapIndex"></param>
/// <param name="quantityElements"></param>
/// <param name="selectiveElements"></param>
void TesselateShape(string type, AssetLocation name, CompositeShape compositeShape, out MeshData modeldata, ITexPositionSource texSource, int generalGlowLevel = 0, byte climateColorMapIndex = 0, byte seasonColorMapIndex = 0, int? quantityElements = null, string[] selectiveElements = null);

/// <summary>
/// Turns a shape into a mesh data object that you can feed into the chunk tesselator or upload to the graphics card for rendering. Uses the given collectible texture configuration as texture source.
/// </summary>
Expand Down
5 changes: 1 addition & 4 deletions Client/API/ITextureAtlasAPI.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vintagestory.API.Common;
using Vintagestory.API.MathTools;

Expand Down Expand Up @@ -218,6 +215,6 @@ public interface ITextureAtlasAPI
/// <param name="targetX"></param>
/// <param name="targetY"></param>
/// <param name="alphaTest"></param>
void RenderTextureIntoAtlas(LoadedTexture fromTexture, float sourceX, float sourceY, float sourceWidth, float sourceHeight, float targetX, float targetY, float alphaTest = 0.005f);
void RenderTextureIntoAtlas(int intoAtlasTextureId, LoadedTexture fromTexture, float sourceX, float sourceY, float sourceWidth, float sourceHeight, float targetX, float targetY, float alphaTest = 0.005f);
}
}
33 changes: 29 additions & 4 deletions Client/API/MeshRef.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
using Vintagestory.API.Client;
using Vintagestory.API.MathTools;
using Vintagestory.API.Common;
using System;
using System;

namespace Vintagestory.API.Client
{
public class MultiTextureMeshRef : IDisposable
{
public MeshRef[] meshrefs;
public int[] textureids;

bool disposed;

public bool Disposed => disposed;

public MultiTextureMeshRef(MeshRef[] meshrefs, int[] textureids)
{
this.meshrefs = meshrefs;
this.textureids = textureids;
}

public bool Initialized => meshrefs[0].Initialized;

public void Dispose()
{
foreach (var meshref in meshrefs) meshref.Dispose();
disposed = true;
}


}

/// <summary>
/// A reference to a mesh that's been uploaded onto the graphics card (i.e. that has been placed in an OpenGL <see href="https://www.khronos.org/opengl/wiki/Vertex_Specification#Vertex_Array_Object">VAO</see>). This reference can be used for rendering it.
/// </summary>
public abstract class MeshRef : IDisposable
{
public bool MultidrawByTextureId { get; protected set; }

public abstract bool Initialized { get; }

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion Client/Audio/ILoadedSound.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Vintagestory.API.Common;
using Vintagestory.API.MathTools;

namespace Vintagestory.API.Client
Expand Down
4 changes: 0 additions & 4 deletions Client/Audio/IMusicEngine.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vintagestory.API.Common;

namespace Vintagestory.API.Client
Expand Down
4 changes: 0 additions & 4 deletions Client/Audio/IMusicTrack.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vintagestory.API.Common;
using Vintagestory.API.Common.Entities;
using Vintagestory.API.MathTools;
Expand Down
4 changes: 0 additions & 4 deletions Client/Audio/RainMusicTrack.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vintagestory.API.Common;
using Vintagestory.API.Common.Entities;
using Vintagestory.API.MathTools;
Expand Down
1 change: 1 addition & 0 deletions Client/Audio/SoundParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum EnumSoundType
Music,
Ambient,
Weather,
MusicGlitchunaffected,
AmbientGlitchunaffected,
SoundGlitchunaffected
}
Expand Down
8 changes: 1 addition & 7 deletions Client/EnumCameraType.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Vintagestory.API.Client
namespace Vintagestory.API.Client
{
public enum EnumCameraMode
{
Expand Down
Loading

0 comments on commit b6532b4

Please sign in to comment.