goldsrc-bsp-viewer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-05-31
9
+
10
+ ### Added
11
+ - Initial release of the GoldSrc BSP Viewer.
12
+ - Support for GoldSrc (Half-Life) BSP v30 map parsing.
13
+ - WAD3 texture loading.
14
+ - Real-time Lightmap rendering with atlas support.
15
+ - Interactive Entity Inspector.
16
+ - FGD metadata integration.
17
+ - Standard FPS-style "Noclip" controls.
18
+ - Entity connection visualization (target/targetname).
19
+ - Toggleable brush wireframes and map axes.
20
+ - Support for AAA-trigger transparency.
21
+ - Adjustable texture and lightmap filtering.
22
+ - PVS-based visibility (hidden/disabled by default).
23
+ - Repository documentation: LICENSE, README, CONTRIBUTING, CHANGELOG.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gastรณn Urgorri
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,160 @@
1
+ # GoldSrc BSP Viewer ๐ŸŽฎ
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/urgorri/goldsrc-bsp-viewer/releases)
5
+
6
+ A high-performance, framework-agnostic GoldSrc (Half-Life) BSP map viewer library built with **Three.js**. It also includes an optional **React** wrapper for easy integration.
7
+
8
+ ---
9
+
10
+ ### ๐ŸŽฅ Demo
11
+
12
+ ![GoldSrc BSP Viewer Demo 1](./resources/demo1.gif)
13
+
14
+ ---
15
+
16
+ ## ๐Ÿš€ Quick Start (Vanilla JS)
17
+
18
+ Install the library via npm:
19
+
20
+ ```bash
21
+ npm install goldsrc-bsp-viewer
22
+ ```
23
+
24
+ Integrate it into any DOM container:
25
+
26
+ ```javascript
27
+ import { BspViewer } from 'goldsrc-bsp-viewer';
28
+
29
+ const viewer = new BspViewer({
30
+ container: document.getElementById('viewer-root'),
31
+ antialias: true
32
+ });
33
+
34
+ // Load a map (buffers can be obtained via fetch, file inputs, etc.)
35
+ await viewer.loadMap(bspArrayBuffer, [wadArrayBuffer1, wadArrayBuffer2]);
36
+ ```
37
+
38
+ ---
39
+
40
+ ## โš›๏ธ React Usage
41
+
42
+ The library includes a `ViewerCanvas` component for React applications.
43
+
44
+ ```tsx
45
+ import { ViewerCanvas } from 'goldsrc-bsp-viewer';
46
+
47
+ function App() {
48
+ return (
49
+ <div style={{ width: '100vw', height: '100vh' }}>
50
+ <ViewerCanvas
51
+ pvsEnabled={true}
52
+ showPointEntities={true}
53
+ // ... other options
54
+ onProgress={(percent, message) => console.log(`${message}: ${percent}%`)}
55
+ />
56
+ </div>
57
+ );
58
+ }
59
+ ```
60
+
61
+ ---
62
+
63
+ ## โœจ Features
64
+
65
+ - **๐Ÿš€ BSP v30 Parsing**: Robust parsing of GoldSrc map files.
66
+ - **๐Ÿ–ผ๏ธ WAD3 Support**: Dynamic loading of external textures from multiple `.wad` files.
67
+ - **๐Ÿ’ก Advanced Lightmapping**: High-quality lighting using atlas-based lightmaps with overbrightening and gamma correction.
68
+ - **๐Ÿ” Entity Inspector**: Interactive selection and inspection of entity key-value pairs.
69
+ - **๐Ÿ”— Entity Connections**: Visualize `target` and `targetname` relationships.
70
+ - **๐Ÿ—๏ธ FGD Integration**: Support for FGD files for meaningful entity metadata.
71
+ - **๐Ÿ•น๏ธ FPS Controls**: Smooth noclip movement with acceleration and friction.
72
+ - **๐Ÿ› ๏ธ Customization**: Toggleable wireframes, axes, transparency, and texture filtering.
73
+
74
+ ---
75
+
76
+ ## ๐Ÿ“– Detailed Usage
77
+
78
+ ### Initializing the Viewer
79
+
80
+ The `BspViewer` constructor accepts an options object:
81
+
82
+ ```typescript
83
+ const viewer = new BspViewer({
84
+ container: HTMLElement, // Required
85
+ backgroundColor: number, // Default: 0x050505
86
+ antialias: boolean, // Default: true
87
+ showAxes: boolean, // Default: true
88
+
89
+ // Callbacks
90
+ onProgress: (percent, msg) => { ... },
91
+ onEntitySelect: (entity) => { ... },
92
+ onLockChange: (locked) => { ... },
93
+
94
+ // Rendering Options
95
+ pvsEnabled: boolean,
96
+ textureFiltering: boolean,
97
+ lightmapFiltering: boolean,
98
+ // ... and more
99
+ });
100
+ ```
101
+
102
+ ### Loading Files
103
+
104
+ You need to provide the files as `ArrayBuffer`. Here is a common pattern using `fetch`:
105
+
106
+ ```javascript
107
+ async function loadMap(mapName) {
108
+ const bspResponse = await fetch(`/maps/${mapName}.bsp`);
109
+ const bspBuffer = await bspResponse.arrayBuffer();
110
+
111
+ const wadResponse = await fetch(`/textures/halflife.wad`);
112
+ const wadBuffer = await wadResponse.arrayBuffer();
113
+
114
+ await viewer.loadMap(bspBuffer, [wadBuffer]);
115
+ }
116
+ ```
117
+
118
+ ### Event Handling
119
+
120
+ ```javascript
121
+ viewer.addEventListener('progress', ({ percent, message }) => {
122
+ console.log(`Loading: ${percent}% - ${message}`);
123
+ });
124
+
125
+ viewer.addEventListener('entitySelect', (entity) => {
126
+ if (entity) console.log('Selected entity class:', entity.classname);
127
+ });
128
+ ```
129
+
130
+ ---
131
+
132
+ ## ๐Ÿ•น๏ธ Controls
133
+
134
+ | Action | Control |
135
+ | :--- | :--- |
136
+ | **Move** | `W` `A` `S` `D` |
137
+ | **Up / Down** | `Space` / `Left Ctrl` |
138
+ | **Sprint** | Hold `Shift` |
139
+ | **Look Around** | `Mouse` (Click to lock) |
140
+ | **Select Entity** | `Left Click` (While locked) |
141
+ | **Unlock Mouse** | `Esc` |
142
+
143
+ ---
144
+
145
+ ## ๐Ÿค Contributing
146
+
147
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
148
+
149
+ ## ๐Ÿ“„ License
150
+
151
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
152
+
153
+ ## ๐Ÿ‘ค Author
154
+
155
+ **Gastรณn Urgorri**
156
+ - GitHub: [@urgorri](https://github.com/urgorri)
157
+ - Email: [urgorrigaston@gmail.com](mailto:urgorrigaston@gmail.com)
158
+
159
+ ---
160
+ *Developed with โค๏ธ for the GoldSrc modding community.*