resonance 1.0.1
Loading...
Searching...
No Matches
freqappearancedetail.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4
6#include "game/freqpart.h"
7#include "math/color.h"
8#include "math/vector2.h"
9#include "os/hxstr.h"
10#include "stream/ibstream.h"
11#include "stream/obstream.h"
12
13namespace Rnd {
14class View;
15}
16
37public:
45
56
67
78 void save(OBStream &stream);
79
90 void load(IBStream &stream);
91
101 void clear();
102
115 void copyFrom(const FreqAppearanceDetail &other);
116
127 std::list<FreqPart *> &parts() {
128 return mParts;
129 }
130
142 void pack(FreqPart::Packed *pOut, int *pCount);
143
158 void unpack(const FreqPart::Packed *pRecords, int nCount);
159
170
181
193 void selectTemplate(const HxStr &name);
194
206
218 void nudgeCursor(int nStepX, int nStepZ);
219
230 FreqPart *selectPart(int nIndex);
231
242 void deletePart(int nIndex);
243
254
264 void randomize();
265
275 void recentrePart(int nIndex);
276
286
296
309
319
330 void setColor(const Color &color, const Vector2 &palettePosition);
331
341 void attachTo(Rnd::View *pParent);
342
352 void detachFrom(Rnd::View *pParent);
353
354private:
355 // Give a newly read part a mesh with its template's material and scale, hang it from mView,
356 // colour it from the palette, append it, and reset the placement state. load() and unpack()
357 // expand the same body.
358 void addLoadedPart(FreqPart *pPart);
359
360 // Report the part at one position, or the last part when the list is shorter. Four routines
361 // expand the same walk.
362 FreqPart *partAt(int nIndex);
363
364 // Move the previewed or selected mesh through the draw order. sendBackward() and
365 // bringForward() expand the same body with opposite steps.
366 void moveCursorDraw(int nSteps);
367
368 std::list<FreqPart *> mParts; // +0xa0
369
370public:
378
379private:
380 unsigned char mTailPadding[0x8]; // +0xa8, pads the object to 0xb0 bytes
381};
void bringForward()
Move the previewed or selected mesh one step later in the draw order.
void setColor(const Color &color, const Vector2 &palettePosition)
Record the current colour and apply it to the previewed or selected part.
void ensureCursorMesh()
Create the preview mesh if there is none, hanging it from mView, and clear three placement words.
void recentrePart(int nIndex)
Move one part and the cursor to the origin and bring the part to the front.
~FreqAppearanceDetail()
Discard every part and delete the view.
Rnd::View * mView
The avatar view the constructor allocates, 0x120 bytes.
Definition freqappearancedetail.h:377
void randomize()
Give each part that may be randomised a random change.
FreqPart * selectPart(int nIndex)
Start editing one part, retaining a copy to revert to.
int drawIndexOf(FreqPart *pPart)
Report where a part's mesh sits in the view's draw order.
void sendBackward()
Move the previewed or selected mesh one step earlier in the draw order.
void resetCursor()
Hide the preview mesh at the origin with no material and return the placement state to its unset valu...
void clear()
Delete every part, empty the view, and reset the placement state.
void deletePart(int nIndex)
Reset the placement state and delete one part.
FreqAppearanceDetail(const FreqAppearanceDetail &other)
Build a fresh avatar and copy another one's parts in.
std::list< FreqPart * > & parts()
Report the parts the avatar is built from.
Definition freqappearancedetail.h:127
void toggleMirror()
Mirror the previewed or selected part.
void save(OBStream &stream)
Write the avatar to a stream.
void pack(FreqPart::Packed *pOut, int *pCount)
Pack every part into consecutive 8-byte records.
void unpack(const FreqPart::Packed *pRecords, int nCount)
Append parts unpacked from consecutive 8-byte records.
void placeCursor()
Place the previewed part, or stop editing the selected one.
void selectTemplate(const HxStr &name)
Start placing a new part of one template.
void detachFrom(Rnd::View *pParent)
Unhang mView from a parent view.
void revertSelection()
Restore the selected part's colour, mirroring, draw position, and placement from the copy selectPart(...
void load(IBStream &stream)
Append the parts save() wrote.
void copyFrom(const FreqAppearanceDetail &other)
Append a copy of each of another avatar's parts, in the other view's draw order.
void nudgeCursor(int nStepX, int nStepZ)
Move the cursor one unit, moving the preview mesh or the selected part along with it.
void attachTo(Rnd::View *pParent)
Hang mView from a parent view.
FreqAppearanceDetail()
Start with an empty part list and a fresh view named by the FreQ maker asset manager.
FreqMakerCursor()
Start with no template selected, an unset scale, and the FreQ maker default colour.
One placed part of a FreQ avatar.
Definition freqpart.h:25
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Input half of the byte stream interface.
Definition ibstream.h:36
Output half of the byte stream interface.
Definition obstream.h:25
Root of a loadable scene.
Definition view.h:47
The rendering engine.
Definition animhelper.h:3
Linear colour with four float components.
Definition color.h:10
Eight-byte transfer form of a part that Pack() writes and Unpack() reads.
Definition freqpart.h:32
Two-component vector, used for texture coordinates.
Definition vector2.h:10