Skip to content

Instantly share code, notes, and snippets.

View ykafia's full-sized avatar

Youness KAFIA ykafia

View GitHub Profile
@ykafia
ykafia / ByteCodeMixin.md
Last active June 16, 2023 11:09
Bytecode mixin

Byte code mixin

What i have so far

Currently have made a spirv parser/assembler library. The api is not versatile to make sure of minimal allocation.

There's a WordBuffer class containing functions like AddOpVariable and AddOpTypeInteger with parameters. Each parameters is then put into a stack allocated array and pushed to the buffer.

SPIR-V instructions

@ykafia
ykafia / IVector2.cs
Last active December 3, 2022 18:39
Vector 2 interface for Stride.Math
using System.Numerics;
internal interface IVector2<T, Num>
where T :
struct,
IVector2<T, Num>
where Num : INumber<Num>
{
public Num X { get; set; }
public Num Y { get; set; }

Hello there! So my name is Youness, i'm currently working as a data engineer and on my free time i love to do some artsy stuff. My interest for softwares and my passion for art has obviously led me to game development and computer graphics. I love experimenting, creating new ideas, trying new processes and such and that's what i found when i discovered the Stride game engine and i'd like to share my process for experimenting in graphics with Stride.

But let's dive in and experiment with our first shaders.

Here's the Stride Game studio, as you can see we have a plane colored in black. The reason is that the material is empty, nothing to compute of course. For our first experiment we'll create a shader to give our plane a little bit of color.

choose color to emissive map

public class SPVByteCode
{
public Instructions[] instructions;
}
public class ShaderCode
{
public List<SPVByteCode> ByteCodePieces;
public AST Tree;
public static class EntityExtensions
{
public static void LookAt(this Entity e, Vector3 target)
{
float azimuth = GetLookAtAngles(e.Transform.Position, target, out float altitude);
var result = Quaternion.RotationYawPitchRoll(azimuth, -altitude, 0);
e.Transform.Rotation = result;
}
public static Vector3 Position(this Entity e) => e.Transform.Position;
private static float GetLookAtAngles(Vector3 source, Vector3 destination, out float altitude)
using Stride.Core.Mathematics;
using Stride.Engine;
using Stride.Input;
namespace SomeNameSpace
{
public class CameraFollow : SyncScript
{
public float DelaySpeed = 0.6f;