Skip to content

Instantly share code, notes, and snippets.

View NicolasCaous's full-sized avatar
🇧🇷

Caoux NicolasCaous

🇧🇷
  • Zeist, Netherlands
View GitHub Profile
@NicolasCaous
NicolasCaous / location_cache.dart
Created December 5, 2019 03:12
A flutter singleton async-safe example
import 'dart:async';
import 'dart:convert';
import 'dart:typed_data';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:hive/hive.dart';
class LocationCacheSingleton {
static LocationCacheSingleton _instance;
static Future<Null> _mutex;
@NicolasCaous
NicolasCaous / farm_list_bloc.dart
Created December 5, 2019 03:35
Flutter complex BloC example
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:bloc/bloc.dart';
import 'package:boinalinha/models/farm.dart';
import 'package:boinalinha/services/data_providers/farm_list.dart';
import './bloc.dart';
class FarmListBloc extends Bloc<FarmListEvent, FarmListState> {
final FarmListRepository farmListRepository;
@NicolasCaous
NicolasCaous / TriangleSubdivisionV1.cs
Last active May 3, 2024 16:45
Triangle subdivision algorithm unity3d
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting.Antlr3.Runtime.Tree;
using UnityEngine;
public class TerrainRenderer : MonoBehaviour
{
struct Vertex
{
@NicolasCaous
NicolasCaous / TerrainCS.hlsl
Created May 3, 2024 16:46
Triangle subdivision algorithm v2
#pragma kernel ComputeSizes
#pragma kernel ComputeVerticesAndIndices
struct Uniforms
{
uint subdivisions;
uint vertex_count;
uint index_count;
};
#pragma kernel ComputeSizes
#pragma kernel ComputeVertices
#pragma kernel ComputeTriangles
struct Uniforms
{
uint subdivisions;
uint current_subdivision;
uint triangles_count;
uint vertex_count;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Rendering;
public class TerrainRenderer : MonoBehaviour
{
[StructLayout(LayoutKind.Sequential)]
public struct Uniforms
{
public const int size = sizeof(uint) * 4 + sizeof(float) * 3;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Rendering;
public class TerrainRenderer : MonoBehaviour
{
[StructLayout(LayoutKind.Sequential)]
public struct Uniforms
{
public const int size = sizeof(uint) * 4 + sizeof(float) * 4;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Rendering;
public class TerrainRenderer : MonoBehaviour
{
[StructLayout(LayoutKind.Sequential)]
public struct Uniforms
{
public const int size = sizeof(uint) * 4 + sizeof(float) * 6;