Skip to content

Instantly share code, notes, and snippets.

View chakmeshma's full-sized avatar

Majid Motallebikashani chakmeshma

View GitHub Profile
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.XR;
public class VRInputManager : MonoBehaviour
{
public TextureManager textureManager;
public float restthreshold = 0.3f;
using System.Runtime.InteropServices;
using System;
using UnityEngine;
using System.Drawing;
public class TextureSlicer : MonoBehaviour
{
[DllImport("DevILWrapper.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr getImagedata(string filePath, out int width, out int height);
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEditor;
using UnityEngine;
public class TextureSlicer : MonoBehaviour
{
@chakmeshma
chakmeshma / screenshot.cpp
Last active January 7, 2024 09:57
Unreal Screenshot Stuff
UTexture2D* ACustomHUD::CreateTextureFromBitmapArray(TArray<FColor>&& BitmapArray, uint16 Width, uint16& outCalculatedHeight)
{
check(BitmapArray.Num() % Width == 0);
outCalculatedHeight = BitmapArray.Num() / Width;
UTexture2D* theTexture = UTexture2D::CreateTransient(Width, outCalculatedHeight);
FTexture2DMipMap& BaseMip = theTexture->PlatformData->Mips[0];
@chakmeshma
chakmeshma / main.cpp
Created October 30, 2017 07:38
Vulkan Basic Startup C++
//Mit dem Angriff Steiners wird alles in Ordnung sein!
#include <vulkan\vulkan.h>
#include <iostream>
#include <string>
#include <vector>
#pragma comment(lib, "vulkan-1.lib")
std::string getVersionString(uint32_t versionBitmask) {
@chakmeshma
chakmeshma / SinStack.java
Created May 17, 2017 20:25
This code causes the stack of the calling thread to look like a sin function over a specific time.
public class SinStack {
public static void drawCurve(float radius, int resolution, float totalWaitTime, int cycles) {
float cycleWaitTime = totalWaitTime / cycles;
float partAngle = (float) (Math.PI / resolution);
float partWidth = cycleWaitTime / resolution;
for (int i = 0; i < resolution * cycles; i++) {
float angleLow = partAngle * i;
float angleHigh = partAngle * (i + 1);