Skip to content

Commit

Permalink
Add alternative grenade model.
Browse files Browse the repository at this point in the history
  • Loading branch information
vikpe committed Sep 4, 2024
1 parent c5428cc commit c4ee32e
Show file tree
Hide file tree
Showing 6 changed files with 241 additions and 6 deletions.
Binary file added public/assets/models/grenade_v2.bin
Binary file not shown.
209 changes: 209 additions & 0 deletions public/assets/models/grenade_v2.gltf
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
{
"asset": {
"generator": "Noesis",
"version": "2.0"
},
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
],
"nodes": [
{
"name": "mesh0_noesis_meshnode_0000",
"translation": [
0.0,
0.0,
0.0
],
"rotation": [
0.0,
0.0,
0.0,
1.0
],
"scale": [
1.0,
1.0,
1.0
],
"mesh": 0
}
],
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 1,
"NORMAL": 2,
"TANGENT": 3,
"TEXCOORD_0": 4
},
"indices": 0,
"material": 0,
"mode": 4
}
],
"name": "mesh0"
}
],
"materials": [
{
"pbrMetallicRoughness": {
"baseColorTexture": {
"index": 0
},
"metallicFactor": 0.0
},
"name": "skin0"
}
],
"textures": [
{
"sampler": 0,
"source": 0
}
],
"images": [
{
"uri": "grenade_v2_0.png"
}
],
"samplers": [
{
"magFilter": 9729,
"minFilter": 9729,
"wrapS": 10497,
"wrapT": 10497
}
],
"accessors": [
{
"bufferView": 0,
"byteOffset": 0,
"componentType": 5123,
"count": 216,
"max": [
112
],
"min": [
0
],
"type": "SCALAR"
},
{
"bufferView": 1,
"byteOffset": 0,
"componentType": 5126,
"count": 113,
"max": [
10.546875,
4.484375,
3.859375
],
"min": [
-8.625,
-4.296875,
-3.75
],
"type": "VEC3"
},
{
"bufferView": 2,
"byteOffset": 0,
"componentType": 5126,
"count": 113,
"max": [
1.0,
1.0,
1.0
],
"min": [
-1.0,
-1.0,
-1.0
],
"type": "VEC3"
},
{
"bufferView": 3,
"byteOffset": 0,
"componentType": 5126,
"count": 113,
"max": [
0.295241892337799072265625,
1.0,
0.850650966167449951171875,
1.0
],
"min": [
-1.0,
-1.0,
-0.88871848583221435546875,
1.0
],
"type": "VEC4"
},
{
"bufferView": 4,
"byteOffset": 0,
"componentType": 5126,
"count": 113,
"max": [
0.974609375,
0.994140625
],
"min": [
0.021484375,
0.021484375
],
"type": "VEC2"
}
],
"bufferViews": [
{
"buffer": 0,
"byteOffset": 0,
"byteLength": 432,
"target": 34963
},
{
"buffer": 0,
"byteOffset": 432,
"byteLength": 1356,
"byteStride": 12,
"target": 34962
},
{
"buffer": 0,
"byteOffset": 1788,
"byteLength": 1356,
"byteStride": 12,
"target": 34962
},
{
"buffer": 0,
"byteOffset": 3144,
"byteLength": 1808,
"byteStride": 16,
"target": 34962
},
{
"buffer": 0,
"byteOffset": 4952,
"byteLength": 904,
"byteStride": 8,
"target": 34962
}
],
"buffers": [
{
"byteLength": 5856,
"uri": "grenade_v2.bin"
}
]
}
Binary file added public/assets/models/grenade_v2_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions src/features/ModelTextureEditor/ModelTextureEditor.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts" setup>
import { onBeforeMount, onBeforeUnmount, onMounted } from "vue";
import { ModelViewer, itemToViewerSettings } from "@/pkg/ModelViewer";
import { Items } from "@/pkg/quake/items";
import { itemToViewerSettings, ModelViewer } from "@/pkg/ModelViewer";
import { Texture } from "@/pkg/quake/models";
import { itemToEditorSettings, TextureEditor } from "./pixi/TextureEditor";
import { toCustomTextureUrl } from "@/pkg/stringUtil";
import { onBeforeMount, onBeforeUnmount, onMounted } from "vue";
import { TextureEditor, itemToEditorSettings } from "./pixi/TextureEditor";
import { Brush } from "./pixi/brush";
import { FilterInputs } from "./pixi/filter";
import { toCustomTextureUrl } from "@/pkg/stringUtil";
interface Props {
item: Items;
Expand Down Expand Up @@ -181,6 +181,7 @@ onBeforeMount(() => {
<span class="text-gray-500 text-xs"
>{{ props.item.model.textureDirPath }}/</span
><strong>{{
props.item.model.textures[index].destFilename ??
props.item.model.textures[index].filename
}}</strong>
<span class="text-gray-500 text-xs ml-2"
Expand All @@ -195,7 +196,8 @@ onBeforeMount(() => {
@click="
() =>
editors[index]?.download(
props.item.model.textures[index].filename
props.item.model.textures[index].destFilename ??
props.item.model.textures[index].filename
)
"
>
Expand Down
9 changes: 8 additions & 1 deletion src/pkg/quake/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,20 @@ const Grenade: Items = {
viewerOrientation: 90,
};

const GrenadeAlt: Items = {
category: "Projectiles",
id: modelToId(quakeModels.GrenadeV2),
model: quakeModels.GrenadeV2,
viewerOrientation: 90,
};

const Missile: Items = {
category: "Projectiles",
id: modelToId(quakeModels.Missile),
model: quakeModels.Missile,
viewerOrientation: 90,
};
export const projectiles: Items[] = [Grenade, Missile];
export const projectiles: Items[] = [Grenade, GrenadeAlt, Missile];

const Quad: Items = {
category: "Powerups",
Expand Down
17 changes: 17 additions & 0 deletions src/pkg/quake/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { slugify } from "../stringUtil";
export interface Texture {
index: number;
filename: string;
destFilename?: string;
width: number;
height: number;
}
Expand Down Expand Up @@ -104,6 +105,22 @@ export const Grenade: Model = {
customTextureSets: [],
};

export const GrenadeV2: Model = {
name: "Grenade (v2)",
filename: "grenade_v2.gltf",
textureDirPath: "qw/textures/models",
textures: [
{
index: 0,
filename: "grenade_v2_0.png",
destFilename: "grenade_0.png",
width: 256,
height: 256,
},
],
customTextureSets: [],
};

export const Missile: Model = {
name: "Missile",
filename: "missile.gltf",
Expand Down

0 comments on commit c4ee32e

Please sign in to comment.