-
Main Article (Author: Greg Turk)
-
Clarifications (Author: Andrew Kingdom)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The most atomic way to train and run inference for a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { RectangleButton } from 'SpectaclesUIKit.lspkg/Scripts/Components/Button/RectangleButton'; | |
| import { SnapCloudRequirements } from './SnapCloudRequirements'; | |
| /** | |
| * VideoStreamingController - Live video streaming to Supabase Realtime for real-time viewing | |
| * Based on Remote ARsistance pattern - streams frames for live viewing, no storage | |
| * | |
| * KEY DIFFERENCE from VideoCaptureUploader: | |
| * - This STREAMS for live viewing (no file storage) | |
| * - VideoCaptureUploader UPLOADS for video composition (stores files) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import ModelIO | |
| import simd | |
| nonisolated func loadMeshWithModelIO(from url: URL) throws -> TriangleMesh { | |
| let asset = MDLAsset(url: url) | |
| guard asset.count > 0 else { | |
| throw NSError(domain: "ModelIO", code: 1, userInfo: [NSLocalizedDescriptionKey: "No objects found in file"]) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| struct BranchSegment { | |
| var startPosition: SIMD3<Float> | |
| var endPosition: SIMD3<Float> | |
| var radius: Float | |
| init(startPosition: SIMD3<Float>, endPosition: SIMD3<Float>, radius: Float) { | |
| self.startPosition = startPosition | |
| self.endPosition = endPosition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef MorphingSpherePlaneParams_h | |
| #define MorphingSpherePlaneParams_h | |
| struct MorphingSpherePlaneParams { | |
| int latitudeBands; | |
| int longitudeBands; | |
| float radius; | |
| float morphAmount; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| withAlpha, | |
| withoutAlpha, | |
| } from "SpectaclesInteractionKit.lspkg/Utils/color"; | |
| /** | |
| * Enhanced 3D Line component with smooth spline interpolation | |
| * Creates a 3D tube by extruding a circular cross-section along a path defined by scene objects. | |
| */ | |
| @component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| withAlpha, | |
| withoutAlpha, | |
| } from "SpectaclesInteractionKit.lspkg/Utils/color"; | |
| import InteractorLineRenderer, { | |
| VisualStyle, | |
| } from "SpectaclesInteractionKit.lspkg/Components/Interaction/InteractorLineVisual/InteractorLineRenderer"; | |
| /** | |
| * This class provides visual representation for a spline curve through a series of control points. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Import required modules | |
| const WorldQueryModule = require("LensStudio:WorldQueryModule"); | |
| const EPSILON = 0.01; | |
| /** | |
| * DirectionalWorldQuery | |
| * | |
| * A utility that performs world queries in a direction defined by two scene objects. | |
| * It can then project rays from a third object in that same direction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Event from "SpectaclesInteractionKit/Utils/Event"; | |
| const HOST = "wss://[APP_NAME].herokuapp.com"; | |
| export class WebSocketConnection { | |
| private remoteServiceModule: RemoteServiceModule = require("LensStudio:RemoteServiceModule"); | |
| private webSocket: WebSocket; | |
| private onMessageEvent = new Event<WebSocketMessageEvent>(); | |
| public readonly onMessage = this.onMessageEvent.publicApi(); |
NewerOlder