(de)serialize runescape classic 3D models
npm install @2003scape/rsc-modelsmodels dumped and loaded into blender:
!altar model
!range model
!fire model
!chest model
models exported from blender and loaded into the game:
!n64 table model
!yoshi and gnome trees
$ npm install @2003scape/rsc-models # -g for CLI program
rsc-models Commands:
rsc-models dump-obj dump model OBJs from models jag
archive
rsc-models pack-obj pack model OBJ(s) into models jag
archive
Options:
--help Show help [boolean]
--version Show version number [boolean]
` $ rsc-models dump-obj config85.jag models36.jag -o models36-obj/
$ rsc-models pack-obj config85.jag models37.jag yoshi.obj n64.obj
example
`javascript
const fs = require('fs');
const { Config } = require('@2003scape/rsc-config');
const { Models } = require('@2003scape/rsc-models');const config = new Config();
config.loadArchive(fs.readFileSync('./config85.jag'));
const models = new Models(config);
models.loadArchive(fs.readFileSync('./models36.jag'));
// dumping wavefront
const tree = models.getModelByName('tree');
fs.writeFileSync('./tree.obj', tree.getObj());
fs.writeFileSync('./tree.mtl', tree.getMtl());
// loading external wavefront
const yoshi = models.fromWavefront(
fs.readFileSync('./yoshi.obj', 'utf8'),
fs.readFileSync('./yoshi.mtl', 'utf8')
);
models.setModel('tree', yoshi);
fs.writeFileSync('./models37.jag', models.toArchive());
`api
$3
create a new models (de)serializer instance. extraNames are an array of model
names that aren't stored in the config archive's objects cache.$3
loads a models jag archive buffer.$3
array of valid model names.$3
return an array of all Model instances.$3
return a Model instance by name (defined in
rsc-config).$3
return a Model instance based on index of model name.$3
return a Model instance from wavefront .obj and .mtl file strings.$3
return a models jag archive buffer.$3
create a new model, either empty or using existing properies.$3
name of ob3 file to use in archive (without extension).$3
array of { x, y, z } integers.$3
`javascript
[
{
// front face material
fillFront: {
i: 1, // illumination, 0 or 1
r, g, b, // (0-248) each channel, or
texture: textureIndex // from rsc-config
} // or null,
fillBack: null, // same format as fillFront, or null
vertices: [] // array of vertex indexes (defined above)
}
]
`$3
iterate through model.faces` and update materials for .mtl file generation.the following models have faces with less than three vertices:
* logbridgelow
* logbridgehigh
* logbridgecurvedhigh
* logbridgecurvedlow
* treeplatformlow2
* treeplatformhigh2
* stonestand
* grand tree-lev 0
* tribalstature
* grand tree-lev 1
* grand tree-lev 2
* fourwayplatform-lev 0
* fourwayplatform-lev 1
* grand tree-lev 3
* blurberrybar
* cave snaptrap
* cave snaptrapa
* rocksteps
there are also 25 secret models that are never loaded in the game (hashed):
* 1037362809
* -1060436729
* -1115958269
* -1220733691
* 1227393374
* -1263331649
* 1347842162
* -1430585029
* 1512310831
* 1526156672
* 1540002513
* 1657318544
* 1721021053
* 2142891767
* -380606436
* 515450526
* 529296367
* 538300861
* 550294861
* 564140702
* 587507422
* -669716258
* -741690938
* 763644315
* 846098451
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along
with this program. If not, see http://www.gnu.org/licenses/.