Skip to content

Instantly share code, notes, and snippets.

View elkraneo's full-sized avatar

Cristian Díaz elkraneo

View GitHub Profile
@Matt54
Matt54 / BurnFadeModelView.swift
Last active July 16, 2025 20:47
Burn Fade Animation for USDZ Models in RealityKit using LowLevelMesh, ShaderGraphMaterial & Metal Compute Shader
import Metal
import RealityKit
import SwiftUI
struct BurnFadeModelView: View {
@State var lowLevelMesh: LowLevelMesh?
@State var timer: Timer?
@State var isForward: Bool = true
@State var morphProgress: Float = 0.0
@State var dwellCounter: Int = 0
@Matt54
Matt54 / SpotLightsShadowGridSphereView.swift
Created July 26, 2024 11:20
RealityView with 6 shadow casting SpotLights beaming through a sphere with many holes inside of an extruded shape box
import RealityKit
import SwiftUI
struct SpotLightsShadowGridSphereView: View {
@State private var rootEntity: Entity?
@State private var timer: Timer?
@State private var rotationAngles: SIMD3<Float> = [0, 0, 0]
@State private var lastRotationUpdateTime = CACurrentMediaTime()
var body: some View {
@lukeredpath
lukeredpath / Converting a TCA App to Swift 6.md
Last active August 24, 2025 04:42
Converting a TCA app to Swift 6

I maintain the Community mobile app - a moderately large codebase that is fully modularized using Swift Package Manager and uses The Composable Architecture. I have recently completed the process of getting the project ready for Xcode 16 and Swift 6 and I wanted to outline the approach I took and some of the issues I encountered, especially regarding TCA.

The Approach

There are already [good

@ynagatomo
ynagatomo / RealityRendererTest.swift
Last active August 29, 2025 18:49 — forked from arthurschiller/RealityRendererTest.swift
RealityRenderer Test (visionOS)
//
// RealityRendererView.swift
// RealityRendererTest
//
// Created by Arthur Schiller on 11.01.24.
//
// Change Log: by Yasuhito Nagatomo
// - Added ImageBasedLighting, Mar 2, 2024
// - Added Camera a rotation animation, Mar 2, 2024
@ole
ole / swift-has-feature.sh
Last active September 7, 2025 10:12
swift-list-features: List Swift compiler upcoming and experimental feature flags. If you're using Swift 6.2 or later, `swift -print-supported-features` does something very similar, but only for the compiler version you have installed. · swift-has-feature: Check if a given compiler knows a specific feature flag, and whether it's an upcoming or ex…
#!/bin/zsh
# Test if the Swift compiler knows about a particular language feature.
#
# Usage:
#
# swift-has-feature [--swift SWIFT_PATH] [--language-version LANGUAGE_VERSION] FEATURE
#
# The feature should be an upcoming or experimental language feature,
# such as `"StrictConcurrency"` or `"ExistentialAny"`.
@drewolbrich
drewolbrich / ScaledVolumeContentView.swift
Last active April 1, 2025 23:56
An example of how to make visionOS volumes work correctly with Settings > Display > Appearance > Window Zoom
//
// ScaledVolumeContentView.swift
// VolumeScaleExample
//
// Created by Drew Olbrich on 11/6/23.
// Copyright © 2023 Lunar Skydiving LLC. All rights reserved.
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@drewolbrich
drewolbrich / Entity+Opacity.swift
Last active March 6, 2025 03:09
An Entity extension that supports animated changes the opacity of an entity and its descendants
//
// Entity+Opacity.swift
//
// Created by Drew Olbrich on 10/25/23.
// Copyright © 2023 Lunar Skydiving LLC. All rights reserved.
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
c: command
cc: commandContext
v: version
P: payload
N: bulkedPayload
fP: fanoutPayload
aP: additionalPayload
Pm: payloadMetadata
i: messageId
U: messageUUID
@keturn
keturn / SDXL_Prompt_Styles.txt
Last active July 8, 2025 21:23
SDXL styles - Credit for the prompts goes to MechanicalReproductions & sedetweiler.com - https://discord.com/channels/1002292111942635562/1089974139927920741/1130958251962417304
Style: Enhance
Positive: breathtaking {prompt} . award-winning, professional, highly detailed
Negative: ugly, deformed, noisy, blurry, distorted, grainy
Style: Anime
Positive: anime artwork {prompt} . anime style, key visual, vibrant, studio anime, highly detailed
Negative: photo, deformed, black and white, realism, disfigured, low contrast
Style: Photographic
Positive: cinematic photo {prompt} . 35mm photograph, film, bokeh, professional, 4k, highly detailed
@arthurschiller
arthurschiller / rk_wireframeMaterial.metal
Created March 8, 2023 20:51
RealityKit Wireframe Shader (Custom Material)
#include <metal_stdlib>
#include <RealityKit/RealityKit.h>
// Godot Source Credits: https://godotshaders.com/shader/wireframe-shader-godot-4-0/
// https://catlikecoding.com/unity/tutorials/advanced-rendering/flat-and-wireframe-shading/
using namespace metal;
constant half3 albedo = half3(1.0);
constant half3 wireColor = half3(255. / 255, 213. / 255, 6. / 255);