Skip to content

Commit

Permalink
Update to 1.19.0-pre.10
Browse files Browse the repository at this point in the history
  • Loading branch information
tyronx committed Dec 22, 2023
1 parent dc95fe9 commit c75243e
Show file tree
Hide file tree
Showing 168 changed files with 2,955 additions and 2,143 deletions.
3 changes: 3 additions & 0 deletions Client/API/IClientEventAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public interface IAsyncParticleManager
/// <summary>
/// Return false to stop spawning particles
/// </summary>
/// <param name="dt"></param>
/// <param name="manager"></param>
/// <returns></returns>
public delegate bool ContinousParticleSpawnTaskDelegate(float dt, IAsyncParticleManager manager);
Expand Down Expand Up @@ -189,6 +190,7 @@ public interface IClientEventAPI : IEventAPI
/// <summary>
/// Registers a custom itemstack renderer for given collectible object. If none is registered, the default renderer is used. For render target gui, the gui shader and its uniforms are already fully prepared, you may only call RenderMesh() and ignore the modelMat, position and size values - stack sizes however, are not covered by this.
/// </summary>
/// <param name="forObj"></param>
/// <param name="rendererDelegate"></param>
/// <param name="target"></param>
void RegisterItemstackRenderer(CollectibleObject forObj, ItemRenderDelegate rendererDelegate, EnumItemRenderTarget target);
Expand All @@ -197,6 +199,7 @@ public interface IClientEventAPI : IEventAPI
/// Removes a previously registered itemstack renderer
/// </summary>
/// <param name="forObj"></param>
/// <param name="target"></param>
void UnregisterItemstackRenderer(CollectibleObject forObj, EnumItemRenderTarget target);


Expand Down
9 changes: 8 additions & 1 deletion Client/API/IClientWorldAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Vintagestory.API.Common;
using Vintagestory.API.Common.Entities;
using Vintagestory.API.MathTools;
using Vintagestory.API.Server;

namespace Vintagestory.API.Client
{
Expand Down Expand Up @@ -142,8 +143,9 @@ public interface IClientWorldAccessor : IWorldAccessor
/// <summary>
/// Same effect as when player left-click breaks a block, but will not cause actual breakage of the block
/// </summary>
/// <param name="pos"></param>
/// <param name="withTool"></param>
/// <param name="damage"></param>
/// <param name="blockSelection"></param>
void IncurBlockDamage(BlockSelection blockSelection, EnumTool? withTool, float damage);

/// <summary>
Expand All @@ -167,5 +169,10 @@ public interface IClientWorldAccessor : IWorldAccessor
Dictionary<int, IMiniDimension> Dimensions { get; }
IMiniDimension GetOrCreateDimension(int dimId, Vec3d pos);
bool TryGetMiniDimension(Vec3i origin, out IMiniDimension dimension);

/// <summary>
/// Exactly like PlaySoundAt except that it returns the duration of the played sound. (We don't want to change the method signature of PlaySoundAt for API mod breakage reasons)
/// </summary>
int PlaySoundAtAndGetDuration(AssetLocation sound, double x, double y, double z, IPlayer ignorePlayerUid = null, bool randomizePitch = true, float range = 32, float volume = 1f);
}
}
4 changes: 3 additions & 1 deletion Client/API/ICoreClientAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ public interface ICoreClientAPI : ICoreAPI
/// <summary>
/// Triggers a discovery event. HudDiscoveryMessage registers to this event and fades in/out a "discovery message" on the players screen
/// </summary>
/// <param name="message"></param>
/// <param name="sender"></param>
/// <param name="errorCode"></param>
/// <param name="text"></param>
void TriggerIngameDiscovery(object sender, string errorCode, string text);

/// <summary>
Expand Down
7 changes: 7 additions & 0 deletions Client/API/IInputAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ public class MouseButtonState
public bool Left;
public bool Middle;
public bool Right;

public void Clear()
{
Left = false;
Middle = false;
Right = false;
}
}

public delegate void OnHotKeyDelegate(string hotkeycode, KeyCombination keyComb);
Expand Down
14 changes: 10 additions & 4 deletions Client/API/IRenderAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public interface IRenderAPI
/// </summary>
/// <param name="inSlot"></param>
/// <param name="ground"></param>
/// <param name="dt"></param>
/// <returns></returns>
ItemRenderInfo GetItemStackRenderInfo(ItemSlot inSlot, EnumItemRenderTarget ground, float dt);

Expand Down Expand Up @@ -279,7 +280,7 @@ float[] CurrentShadowProjectionMatrix
/// Whether scissor mode should be active or not
/// </summary>
/// <param name="enable"></param>
void GlScissorFlag(bool enable);
void GlScissorFlag(bool enable);



Expand Down Expand Up @@ -429,6 +430,7 @@ float[] CurrentShadowProjectionMatrix
/// <param name="posX">The position for light level reading</param>
/// <param name="posY">The position for light level reading</param>
/// <param name="posZ">The position for light level reading</param>
/// <param name="colorMul"></param>
/// <returns></returns>
IStandardShaderProgram PreparedStandardShader(int posX, int posY, int posZ, Vec4f colorMul = null);

Expand All @@ -452,6 +454,7 @@ float[] CurrentShadowProjectionMatrix
/// <param name="indicesSize">Size of the indices</param>
/// <param name="customFloats">Float values of the mesh</param>
/// <param name="customInts">Float values of the mesh</param>
/// <param name="customShorts"></param>
/// <param name="customBytes">Byte values of the mesh</param>
/// <param name="drawMode">The current draw mode</param>
/// <param name="staticDraw">whether the draw should be static or dynamic.</param>
Expand Down Expand Up @@ -507,13 +510,13 @@ float[] CurrentShadowProjectionMatrix
/// </summary>
/// <param name="mmr"></param>
/// <param name="textureSampleName"></param>
/// <param name="textureNumber"></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);


Expand Down Expand Up @@ -598,6 +601,9 @@ float[] CurrentShadowProjectionMatrix
/// <param name="atlas"></param>
/// <param name="size"></param>
/// <param name="onComplete">Once rendered, this returns a texture subid, which you can use to retrieve the textureAtlasPosition from the atlas</param>
/// <param name="color"></param>
/// <param name="sepiaLevel"></param>
/// <param name="scale"></param>
/// <returns>True if the render could complete immediatly, false if it has to wait until the next ortho render stage</returns>
bool RenderItemStackToAtlas(ItemStack stack, ITextureAtlasAPI atlas, int size, Action<int> onComplete, int color = ColorUtil.WhiteArgb, float sepiaLevel = 0f, float scale = 1f);

Expand Down Expand Up @@ -680,17 +686,16 @@ float[] CurrentShadowProjectionMatrix
void Render2DTexture(int textureid, float posX, float posY, float width, float height, float z = 50, Vec4f color = null);



/// <summary>
/// Renders given texture onto the screen, uses supplied quad for rendering (gui mode)
/// </summary>
/// <param name="quadModel"></param>
/// <param name="textureid"></param>
/// <param name="posX"></param>
/// <param name="posY"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="z"></param>
/// <param name="color"></param>
void Render2DTexture(MeshRef quadModel, int textureid, float posX, float posY, float width, float height, float z = 50);


Expand Down Expand Up @@ -727,6 +732,7 @@ float[] CurrentShadowProjectionMatrix
/// <summary>
/// Inefficiently renders a line between 2 points
/// </summary>
/// <param name="origin"></param>
/// <param name="posX1"></param>
/// <param name="posY1"></param>
/// <param name="posZ1"></param>
Expand Down
2 changes: 2 additions & 0 deletions Client/API/ITesselatorAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ void TesselateShape(
/// <param name="modeldata"></param>
/// <param name="texSource"></param>
/// <param name="rotation"></param>
/// <param name="quantityElements"></param>
/// <param name="selectiveElements"></param>
void TesselateShapeWithJointIds(string typeForLogging, Shape shapeBase, out MeshData modeldata, ITexPositionSource texSource, Vec3f rotation, int? quantityElements = null, string[] selectiveElements = null);

/// <summary>
Expand Down
11 changes: 8 additions & 3 deletions Client/API/ITextureAtlasAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public interface IItemTextureAtlasAPI : ITextureAtlasAPI
/// </summary>
/// <param name="item"></param>
/// <param name="textureName"></param>
/// <param name="returnNullWhenMissing"></param>
/// <returns></returns>
TextureAtlasPosition GetPosition(Item item, string textureName = null, bool returnNullWhenMissing = false);

Expand All @@ -32,6 +33,7 @@ public interface IBlockTextureAtlasAPI : ITextureAtlasAPI
/// </summary>
/// <param name="block"></param>
/// <param name="textureName"></param>
/// <param name="returnNullWhenMissing"></param>
/// <returns></returns>
TextureAtlasPosition GetPosition(Block block, string textureName, bool returnNullWhenMissing = false);

Expand Down Expand Up @@ -92,16 +94,18 @@ public interface ITextureAtlasAPI
/// <param name="bmp"></param>
/// <param name="textureSubId"></param>
/// <param name="texPos"></param>
/// <param name="alphaTest"></param>
/// <returns></returns>
bool InsertTexture(IBitmap bmp, out int textureSubId, out TextureAtlasPosition texPos, float alphaTest = 0f);

/// <summary>
/// Inserts a texture into the texture atlas after the atlas has been generated. Updates the in-ram texture atlas as well as the in-gpu-ram texture atlas.
/// The textureSubId can be used to find the TextureAtlasPosition again in case you loose it ;-)
/// </summary>
/// <param name="bmp"></param>
/// <param name="pngBytes"></param>
/// <param name="textureSubId"></param>
/// <param name="texPos"></param>
/// <param name="alphaTest"></param>
/// <returns></returns>
bool InsertTexture(byte[] pngBytes, out int textureSubId, out TextureAtlasPosition texPos, float alphaTest = 0f);

Expand Down Expand Up @@ -143,7 +147,7 @@ public interface ITextureAtlasAPI
/// A subsequent call to this method will update the texture, but retain the same texPos. Also a run-time texture reload will reload this texture automatically.
/// </summary>
/// <param name="path"></param>
/// <param name="bmp"></param>
/// <param name="pngBytes"></param>
/// <param name="textureSubId"></param>
/// <param name="texPos"></param>
/// <param name="alphaTest"></param>
Expand Down Expand Up @@ -185,7 +189,7 @@ public interface ITextureAtlasAPI
/// <summary>
/// Returns one of 30 random rgba values inside the given texture (defined by its sub-id)
/// </summary>
/// <param name="textureSubId"></param>
/// <param name="texPos"></param>
/// <param name="rndIndex">0..29 for a specific random pixel, or -1 to randomize, which is the same as calling GetRandomColor without the rndIndex argument</param>
/// <returns></returns>
int GetRandomColor(TextureAtlasPosition texPos, int rndIndex);
Expand All @@ -207,6 +211,7 @@ public interface ITextureAtlasAPI
/// <summary>
/// Renders given texture into the texture atlas at given location
/// </summary>
/// <param name="intoAtlasTextureId"></param>
/// <param name="fromTexture"></param>
/// <param name="sourceX"></param>
/// <param name="sourceY"></param>
Expand Down
3 changes: 3 additions & 0 deletions Client/Audio/CaveMusicTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ float IMusicTrack.Priority
/// </summary>
/// <param name="assetManager">the global Asset Manager</param>
/// <param name="capi">The Core Client API</param>
/// <param name="musicEngine"></param>
public void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine)
{
this.capi = capi;
Expand All @@ -124,6 +125,8 @@ public void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEn
/// Should the game play this track?
/// </summary>
/// <param name="props">The properties of the current track.</param>
/// <param name="conds"></param>
/// <param name="pos"></param>
/// <returns>Do we play this track?</returns>
public bool ShouldPlay(TrackedPlayerProperties props, ClimateCondition conds, BlockPos pos)
{
Expand Down
3 changes: 3 additions & 0 deletions Client/Audio/IMusicTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ public interface IMusicTrack
/// </summary>
/// <param name="assetManager">the global Asset Manager</param>
/// <param name="capi">The Core Client API</param>
/// <param name="musicEngine"></param>
void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine);

/// <summary>
/// Should this current track play?
/// </summary>
/// <param name="props">Player Properties</param>
/// <param name="conds"></param>
/// <param name="pos"></param>
/// <returns>Should we play the current track?</returns>
bool ShouldPlay(TrackedPlayerProperties props, ClimateCondition conds, BlockPos pos);

Expand Down
2 changes: 2 additions & 0 deletions Client/Audio/MusicTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public virtual void Initialize(IAssetManager assetManager, ICoreClientAPI capi,
/// Should this current track play?
/// </summary>
/// <param name="props">Player Properties</param>
/// <param name="conds"></param>
/// <param name="pos"></param>
/// <returns>Should we play the current track?</returns>
public virtual bool ShouldPlay(TrackedPlayerProperties props, ClimateCondition conds, BlockPos pos)
{
Expand Down
7 changes: 7 additions & 0 deletions Client/MeshPool/MeshDataPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ private MeshDataPool(int verticesPoolSize, int indicesPoolSize, int maxPartsPerP
/// <param name="indicesPoolSize">The index pool size.</param>
/// <param name="maxPartsPerPool">The maximum parts per pool.</param>
/// <param name="customFloats">The custom floats of the pool.</param>
/// <param name="customShorts"></param>
/// <param name="customBytes">The custom bytes of the pool.</param>
/// <param name="customInts">The custom ints of the pool.</param>
/// <returns>The resulting mesh data pool.</returns>
Expand Down Expand Up @@ -155,6 +156,7 @@ public static MeshDataPool AllocateNewPool(ICoreClientAPI capi, int verticesPool
/// <param name="capi">The core client API</param>
/// <param name="modeldata">The model to add</param>
/// <param name="modelOrigin">The origin point of the model.</param>
/// <param name="dimension"></param>
/// <param name="frustumCullSphere">The culling sphere.</param>
/// <returns>The location of the model (and the data) in the pool.</returns>
public ModelDataPoolLocation TryAdd(ICoreClientAPI capi, MeshData modeldata, Vec3i modelOrigin, int dimension, Sphere frustumCullSphere)
Expand Down Expand Up @@ -442,6 +444,11 @@ public float GetFragmentation()
{
return CurrentFragmentation;
}

public void RenderMesh(IRenderAPI render)
{
render.RenderMesh(modelRef, indicesStartsByte, indicesSizes, indicesGroupsCount);
}
}


Expand Down
Loading

0 comments on commit c75243e

Please sign in to comment.