Skip to content

Instantly share code, notes, and snippets.

View Vatyx's full-sized avatar
💭
🎉

Sahil Dhanju Vatyx

💭
🎉
View GitHub Profile
template <typename Base, typename Derived>
struct TSerialize
{
static void Do(FArchive& Ar, const TUniquePtr<Base>& Payload)
{
Ar.SerializeBits(Payload.Get(), sizeof(Derived));
}
};
template <typename Base, typename Derived>
struct FTMatrix
{
private TArray<bool> Storage;
private int N;
private int M;
FTMatrix(int N, int M)
{
this.N = N;
@Vatyx
Vatyx / SiblingComponentAttribute.cs
Last active April 12, 2024 12:20
Unity SiblingComponent Attribute
namespace Core.Attributes
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field)]
#include "ViewmodelSkeletalMeshComponent.h"
#include "Kismet/GameplayStatics.h"
void UViewmodelSkeletalMeshComponent::BeginPlay()
{
Super::BeginPlay();
PlayerController = UGameplayStatics::GetPlayerController(this, 0);
Compiling leveldb-sys v2.0.8
error: failed to run custom build command for `leveldb-sys v2.0.8`
Caused by:
process didn't exit successfully: `C:\Users\sahildhanju\Documents\leveldb\target\debug\build\leveldb-sys-90fdc454faa06149\build-script-build` (exit code: 101)
--- stdout
[build] Started
[leveldb] Building
running: "cmake" "C:\\Users\\sahildhanju\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\leveldb-sys-2.0.8\\deps\\leveldb-1.22" "-G" "Visual Studio 15 2017" "-Thost=x64" "-Ax64" "-DLEVELDB_BUILD_TESTS=OFF" "-DLEVELDB_BUILD_BENCHMARKS=OFF" "-DCMAKE_INSTALL_LIBDIR=C:\\Users\\sahildhanju\\Documents\\leveldb\\target\\debug\\build\\leveldb-sys-58c5a306fd7e9244\\out\\lib" "-DHAVE_SNAPPY=OFF" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\sahildhanju\\Documents\\leveldb\\target\\debug\\build\\leveldb-sys-58c5a306fd7e9244\\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_A
public static string GetCurrentPathOfProjectWindow()
{
Type projectWindowUtilType = typeof(ProjectWindowUtil);
MethodInfo getActiveFolderPath = projectWindowUtilType.GetMethod("GetActiveFolderPath", BindingFlags.Static | BindingFlags.NonPublic);
object obj = getActiveFolderPath.Invoke(null, new object[0]);
return obj.ToString();
}
#[derive(Copy, Clone, Debug)]
pub struct Vector2<T> {
pub x: T,
pub y: T,
}
impl<T: Copy + Num + Signed> Vector2<T> {
pub fn new(x: T, y: T) -> Vector2<T> where T: Float {
assert!(!x.is_nan() && !y.is_nan());
> [*New to Dota 2? Start here.*](http://goo.gl/IwmCv#heading#intro)
[Read Before Posting: Subreddit FAQ](http://goo.gl/COUhZ#trade#button)
[Subreddit Rules](http://www.reddit.com/r/DotA2/wiki/rules#rules#button)
[Message the Moderators](https://goo.gl/VTTJy7#mods#button)
>>[](#separator)
if (depth < 6)
{
auto V = -r.dir;
auto R = 2 * dot(V, norm) * norm - V;
R.make_unit_vector();
auto ray = Ray(point + 0.001 * norm, R);
if (surface->gamma_e != 0) {
auto recurredLight = trace(ray, ++depth);
light = light + inter.first->gamma_e * recurredLight;
vec3 Raytracer::getLighting(vec3 point, vec3 norm, vec3 origin, Lighting* lighting)
{
vec3 intensity(0, 0, 0);
auto ka = lighting->ka;
auto intensityAmbient = lighting->ia;
intensity = ka * intensityAmbient;