Skip to content

Instantly share code, notes, and snippets.

View kokiTakashiki's full-sized avatar
🐢

kokiTakeda kokiTakashiki

🐢
View GitHub Profile
@st4rdog
st4rdog / TreeReplacerS.cs
Created March 14, 2019 06:38
Replaces trees on a terrain with prefab.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
// Replaces Unity terrain trees with prefab GameObject.
// http://answers.unity3d.com/questions/723266/converting-all-terrain-trees-to-gameobjects.html
[ExecuteInEditMode]
public class TreeReplacerS : EditorWindow {
@AntipodeStudiosDev
AntipodeStudiosDev / AddColliders.cs
Created April 30, 2019 03:51
Unity3D Add Colliders To Terrain Details, Mouse Click To Remove Terrain Details
using UnityEngine;
public class AddColliders : MonoBehaviour
{
public Terrain terrain;
private TreeInstance[] _originalTrees;
void Start()
{
@bwhiteley
bwhiteley / HostingView.swift
Last active June 16, 2023 04:47
Host SwiftUI in a UIView
import Foundation
import SwiftUI
#if os(macOS)
public typealias PlatformViewType = NSView
#elseif !os(watchOS)
import UIKit
public typealias PlatformViewType = UIView
#endif
#if !os(watchOS)
@mattt
mattt / UIViewControllerPreview.swift
Last active January 8, 2024 23:09
Generic structures to host previews of UIView and UIViewController subclasses.
import UIKit
#if canImport(SwiftUI) && DEBUG
import SwiftUI
struct UIViewControllerPreview<ViewController: UIViewController>: UIViewControllerRepresentable {
let viewController: ViewController
init(_ builder: @escaping () -> ViewController) {
viewController = builder()
}
@khanlou
khanlou / A - Usage.swift
Last active July 14, 2024 20:25
This ScrollView has a modifier called `onScroll`, which is updated when scrolls occur.
struct ContentView: View {
@State var scrollOffset: CGPoint = .zero
var body: some View {
ObservableScrollView {
Text("Hello, world!")
.foregroundColor(self.scrollOffset.y == 0 ? .blue : .red)
}
.onScroll { self.scrollOffset = $0 }
@akirayou
akirayou / DNG.py
Last active February 3, 2023 00:18
# -*- coding: utf-8 -*-
"""
Created on Sun May 9 20:45:45 2021
@author: youak
"""
import glob
files=glob.glob("*.DNG")
is_rig_cam=True #meshroom では depth推定できないような配置のrigカメラは逆効果っぽい(dence画像作成時にコケる)
@ynagatomo
ynagatomo / ContentView.swift
Created November 25, 2023 06:58
Custom Debug Window in visionOS
//
// ContentView.swift
// DebugWindow
//
// Created by Yasuhito Nagatomo on 2023/11/25.
//
import SwiftUI
import RealityKit
import RealityKitContent