(Question) Adding arbitrary units/models to an already loaded map
See original GitHub issueIf I want to render, say a sphere, into an already loaded + rendered wc3 map, what would be the most appropriate way to go about this?
Looking at the code in mdx-m3-viewer\src\viewer\handlers\w3x\viewer.ts
lines 627-656:
for (let unit of unitsDoo.units) {
let row: MappedDataRow | undefined;
let path;
// Hardcoded?
if (unit.id === 'sloc') {
path = 'Objects\\StartLocation\\StartLocation.mdx';
} else {
row = this.unitsData.getRow(unit.id);
path = <string>row.file;
if (path.endsWith('.mdl')) {
path = path.slice(0, -4);
}
path += '.mdx';
}
if (path) {
this.load(path)
.then((model) => {
if (model) {
this.units.push(new Unit(this, <MdxModel>model, row, unit));
}
});
} else {
console.log('Unknown unit ID', unit.id, unit);
}
}
It looks like I can just add units/objects to the map like so -
if (model) {
this.units.push(new Unit(this, <MdxModel>model, row, unit));
}
given that I provide -
- a model class
- stub object for
unit
that holds info such as scale, location, angle, player, etc. - stub object for
row
- a model instance class that implements the
setScene
method
My understanding is that the model should be able to create a model instance and is in charge of determining what webgl program to use to render itself. I would start off by using an existing primitive such as a sphere.
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (12 by maintainers)
Top Results From Across the Web
Arbitrary DEM Preparation for use as a Custom Terrain Source
This is an advanced user activity. Map Pilot can use terrain model data that is created by processing imagery in Maps Made Easy....
Read more >Working with models and mapping templates - Amazon API ...
A mapping template is a script expressed in Velocity Template Language (VTL) and applied to the payload using JSONPath expressions .
Read more >HST.583: LAB6 Instructions
You will run a matlab program that loads some images (T1 and proton density maps). You will be asked questions about these images....
Read more >Work with elevation surfaces—ArcGIS Pro | Documentation
Add a ground surface to a map · On the Map tab, in the Layer group, click the Add Data arrow Add Data...
Read more >Django Tutorial Part 3: Using models - Learn web development
This article shows how to define models for the LocalLibrary website. It explains what a model is, how it is declared, and some...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I recommend reading this tutorial and other relevant pages on that site, it has been very useful to me in the past.
Also I just realized that uses
heightMap
, from the time the height values were saved on the client. But you can look atgroundNormal()
just above it 😂