Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/williamvenner/gmod-3d2d-clipping
✂️ Simple library for efficient and cross-platform clipping of 3D2D GUI in Garry's Mod
https://github.com/williamvenner/gmod-3d2d-clipping
3d2d clip clipping gmod lua scissor scissoring stencil stencils
Last synced: 3 months ago
JSON representation
✂️ Simple library for efficient and cross-platform clipping of 3D2D GUI in Garry's Mod
- Host: GitHub
- URL: https://github.com/williamvenner/gmod-3d2d-clipping
- Owner: WilliamVenner
- License: mit
- Created: 2020-12-30T21:32:52.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-31T18:52:22.000Z (about 4 years ago)
- Last Synced: 2024-10-11T11:35:29.472Z (4 months ago)
- Topics: 3d2d, clip, clipping, gmod, lua, scissor, scissoring, stencil, stencils
- Language: Lua
- Homepage:
- Size: 3.91 KB
- Stars: 22
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 3d2d-clipping
✂️ Simple library for efficient and cross-platform clipping of 3D2D GUI in Garry's Mod
## Example
Left: No clipping
Right: 2D clipped## Usage
### Loading the Library
```lua
my_addon.clip = include("lib/clip.lua")
```### Clipping 2D Rectangles
```lua
local width, height = 200, 400
cam.Start3D2D(pos, ang, scale)
my_addon.clip:Scissor2D(width, height)
-- Draw 2D clipped stuff here!
my_addon.clip()
cam.End3D2D()
```### Clipping 3D Bounding Boxes
```lua
local mins, maxs = ent:OBBMins(), ent:OBBMaxs()
-- or
local mins, maxs = ent:GetModelBounds()my_addon.clip:Scissor3D(pos, ang, mins, maxs)
cam.Start3D2D(pos, ang, scale)
-- Draw 3D clipped stuff here!
cam.End3D2D()
my_addon.clip()
```
In most cases, this is not recommended because stencils are fundamentally 2D, leading to depth issues like this: