GPU Optimization for GameDev
By Author
- Emil Persson @Humus
- Matt Pettineo @mynameismjp
fn ui_example_system(mut contexts: EguiContexts) { | |
// Set window styles | |
let ctx = contexts.ctx_mut(); | |
let old = ctx.style().visuals.clone(); | |
ctx.set_visuals(egui::Visuals { | |
window_fill: Color32::TRANSPARENT, | |
panel_fill: Color32::TRANSPARENT, | |
window_stroke: egui::Stroke { | |
color: Color32::TRANSPARENT, | |
width: 0.0, |
/* | |
* OK, now back to business... the rest of this code applies only to the instance. | |
*/ | |
/*------------------------------------------------------------------------------ | |
* MISC TWEAKS | |
* | |
* Miscellaneous tweaks that are more like extensions of the theme, | |
* rather than subsets or features. These could ostensibly be their | |
* own user-styles, and are only bundled in here for convenience. | |
* Or, they are not supported in all browsers. They may be removed |
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"type": "shell", | |
"label": "CMake: build", | |
"command": "cmake --build build/standalone", | |
"group": "build", | |
"problemMatcher": [], | |
"detail": "CMake build task" |
# VS 2019 | |
cmake -G "Visual Studio 16 2019" -A x64 | |
# VS 2022 | |
cmake -G "Visual Studio 17 2022" -A x64 |
const fs = require('fs') | |
const path = require('path') | |
// Loop through all years | |
// Go into each folder | |
// Get MDX file | |
// Add template to frontmatter | |
// layout: "@/layouts/BlogLayout.astro" |
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "cargo check", | |
"type": "shell", | |
"command": "~/.cargo/bin/cargo", // note: full path to the cargo | |
"args": [ |
import * as THREE from "three"; | |
import { MeshProps, useFrame } from "@react-three/fiber"; | |
import { Mesh } from "three"; | |
import { useRef } from "react"; | |
type MultiMaterialMeshProps = MeshProps & {}; | |
export default function MultiMaterialMesh({}: MultiMaterialMeshProps) { | |
const geom = useRef<Mesh>(); |
import * as THREE from "three"; | |
import { MeshProps, Object3DNode, useFrame } from "@react-three/fiber"; | |
import { GlassViewMaterial } from "./shaders/GlassViewShader"; | |
import { Mesh } from "three"; | |
import { useRef } from "react"; | |
// We extend Mesh and replace material with ShaderMaterial - which our custom shader is based off | |
interface GlassViewMesh extends THREE.Mesh { | |
material: THREE.ShaderMaterial; | |
} |
import React, { useEffect, useRef } from "react" | |
import useLoop from "../hooks/useLoop" | |
import playerInput from "../utils/playerInput" | |
type Props = { | |
} | |
const Gamepad = ({ }: Props) => { | |
// The frame/game loop | |
// We run this 60fps (max) to sync gamepad input to Input class/store |