First part of removing states from models #125

Merged
merged 26 commits into from Aug 18, 2016

Projects

None yet

2 participants

@farmboy0
Contributor

This part introduces special node structures to hold mesh and dangly data.
It also allows attaching models directly to other models as this fixes a bug with the current animation system.

@DrMcCoy
Member
DrMcCoy commented Aug 17, 2016 edited

Hmm, for some reason, characters are now slightly transparent in your branch.

This is noticable, for example, on the hair of Bim in the NWN OC Prelude. And in Chapter 2, on, for example, Linu:

lilutransparent lilusolid

(Left is your branch, right xoreos/master)

It could be related to the environment mapping on her armor. Or maybe not, since it happens on heads, too (just not this noticable, for the most part).

@DrMcCoy DrMcCoy commented on an outdated diff Aug 17, 2016
src/graphics/aurora/modelnode.h
+ struct Dangly {
+ float period;
+ float tightness;
+ float displacement;
+
+ DanglyData *data;
+
+ Dangly();
+ };
+
+ struct MeshData {
+ VertexBuffer vertexBuffer; ///< Node geometry vertex buffer.
+ IndexBuffer indexBuffer; ///< Node geometry index buffer.
+
+ std::vector<TextureHandle> textures; ///< Textures.
+
@DrMcCoy
DrMcCoy Aug 17, 2016 Member

Trailing whitespace in lines 138 and 140

@DrMcCoy
Member
DrMcCoy commented Aug 17, 2016

Apart from that tiny style issue in 32484c3 and that bigger transparency issue, the PR looks rather good. Good job! :)

@DrMcCoy
Member
DrMcCoy commented Aug 17, 2016

Hmm, while checking your branch for leaks, I found something "interesting":

There's apparently at least two animations with the same name in at least one model. The model in question is "PLC_H09", the animation name is "die", and the model shows up in the entry area of the Chapter 1 of the NWN OC. I think it might be the mat on the ground where the infected lie, or maybe the infected themselves.

Here is a small patch against your branch that spits out a warning (and also for duplicate states). That also takes care of the memory leak, I think (because std::map::insert() won't overwrite a value, we're basically allocating the extra Animation and then throwing it away without delete'ing it; the patch just bails before allocating the Animation).

I'm not really sure how to handle this. Which of the two animations is the real one? Are the different, even? Does it matter?

(I probably should have added a check there earlier, too. I just didn't think that this could happen, but, well, BioWare. :P)

This is also not necessarily related to your PR as such, but somewhat connected. I'm mainly just thinking out loud here, because it might interest you and so I'm not forgetting this. And maybe someone wants to chime in and/or research this further. :)

@farmboy0
Contributor

I'll check it out and find a solution after comparing the values for both animations.
Btw one of the 2 checks should suffice because animations and states are the same thing in the models.

farmboy0 added some commits Aug 4, 2016
@farmboy0 farmboy0 GRAPHICS: Add node structures to ModelNode to hold special data 666b5a6
@farmboy0 farmboy0 NWN: Use node structures ced89eb
@farmboy0 farmboy0 NWN2: Use node structures adfff20
@farmboy0 farmboy0 KOTOR: Use node structures 1ee2a35
@farmboy0 farmboy0 WITCHER: Use node structures bcfa98d
@farmboy0 farmboy0 DRAGONAGE: Use node structures 10c197e
@farmboy0 farmboy0 JADE: Also keep the list of textures in the context 8410320
@farmboy0 farmboy0 NWN: Attach model parts directly 33cd09f
@farmboy0 farmboy0 JADE: Only create mesh for mesh nodes 45e2e45
@farmboy0 farmboy0 JADE: Load textures on mesh creation 9b49a95
@farmboy0 farmboy0 JADE: Use node structures f23c008
@farmboy0 farmboy0 GRAPHICS: Remove mesh data from ModelNode 0685f28
@farmboy0 farmboy0 GRAPHICS: Allow attaching models to ModelNode 36884fa
@farmboy0 farmboy0 KOTOR: Attach model parts directly 00c2d32
@farmboy0 farmboy0 KOTOR2: Attach model parts directly bb3636b
@farmboy0 farmboy0 JADE: Attach model parts directly 2498fd1
@farmboy0 farmboy0 GRAPHICS: Remove unused methods from ModelNode 69fcbc1
@farmboy0 farmboy0 GRAPHICS: Interpolate animation in Animation class 989d565
@farmboy0 farmboy0 GRAPHICS: Add node methods to class Animation 139bdd4
@farmboy0 farmboy0 GRAPHICS: Render the root state node for state nodes without a mesh 185a3a7
@farmboy0 farmboy0 GRAPHICS: Define only one public block in class Animation a57f7d9
@farmboy0 farmboy0 GRAPHICS: Initialize Animation members in the constructor e0e4af5
@farmboy0 farmboy0 GRAPHICS: Remove unused methods from AnimNode and ModelNode 6df35d1
@farmboy0 farmboy0 GRAPHICS: Don't inherit geometry in NWN models 5d7bb07
@farmboy0 farmboy0 GRAPHICS: Delete mesh data in ModelNode destructor
c531a2a
@farmboy0 farmboy0 GRAPHICS: Add methods to get a node from a named state 6f8a012
@DrMcCoy DrMcCoy merged commit c531a2a into xoreos:master Aug 18, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment