Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Enumerations | Functions | Variables
slot.hpp File Reference

management of texture slots as visible ingame. More...

#include "inexor/engine/shader.hpp"
#include "inexor/network/legacy/buffer_types.hpp"
#include "inexor/shared/cube_types.hpp"
#include "inexor/shared/cube_vector.hpp"
#include "inexor/shared/geom.hpp"

Go to the source code of this file.

Classes

class  VSlot
 A virtual Slot. More...
 
class  Slot
 
struct  Slot::Tex
 
struct  MSlot
 

Enumerations

enum  {
  VSLOT_SHPARAM = 0, VSLOT_SCALE, VSLOT_ROTATION, VSLOT_OFFSET,
  VSLOT_SCROLL, VSLOT_LAYER, VSLOT_ALPHA, VSLOT_COLOR,
  VSLOT_NUM
}
 

Functions

void loadlayermasks ()
 
void clearslots ()
 
void cleanupslots ()
 
void cleanupvslots ()
 
void cleanupmaterialslots ()
 
void propagatevslot (VSlot *root, int changed)
 Apply changes to all following neighbors of root. More...
 
void texturereset (int first, int num=0)
 Resets all textures from the slots-stack. More...
 
MSlotlookupmaterialslot (int slot, bool load=true)
 
Slotlookupslot (int slot, bool load=true)
 
VSlotlookupvslot (int slot, bool load=true)
 
VSlotemptyvslot (Slot &owner)
 Wrapper around new VSlot to reuse unused dead vslots. More...
 
VSloteditvslot (const VSlot &src, const VSlot &delta)
 Select a VSlot beeing src but having modifications based on delta (??) More...
 
void mergevslot (VSlot &dst, const VSlot &src, const VSlot &delta)
 
bool texturedata (ImageData &d, const char *tname, Slot::Tex *tex=nullptr, bool msg=true, int *compress=nullptr)
 
void compactvslots (cube *c, int n=8)
 Loops through all n subcubes of c, (reassigning vs.index to compactvslots++ in markmode and otherwise sets cubetexture to the new vslot) when texture was used. More...
 
void compactvslot (int &index)
 compacting mode: set index to compactvslots++ = vs.index, marking mode, just set vs.index More...
 
void compactvslot (VSlot &vs)
 
int compactvslots ()
 
void compacteditvslots ()
 
void compactmruvslots ()
 
void packvslot (vector< uchar > &buf, const VSlot &src)
 Pack a virtual Slot after it has been modified for broadcasting it to the other clients. More...
 
void packvslot (vector< uchar > &buf, int index)
 
void packvslot (vector< uchar > &buf, const VSlot *src)
 
bool unpackvslot (ucharbuf &buf, VSlot &dst, bool delta)
 Unpack a virtual Slot modified by another client. More...
 

Variables

vector< Slot * > slots
 
vector< VSlot * > vslots
 

Detailed Description

management of texture slots as visible ingame.

each texture slot can have multiple images. additional images can be used for various shaders. It is organized in two structures: virtual Slots and normal Slots. Each Slot can have a node-chain of numerous virtual Slots which contain differing shader stuff, or scaling, color, rotation.. So a bunch of textures (a Slot) can easily be varying ingame.


Class Documentation

struct Slot::Tex
Class Members
int combined
string name
Texture * t
int type

Enumeration Type Documentation

anonymous enum
Enumerator
VSLOT_SHPARAM 
VSLOT_SCALE 
VSLOT_ROTATION 
VSLOT_OFFSET 
VSLOT_SCROLL 
VSLOT_LAYER 
VSLOT_ALPHA 
VSLOT_COLOR 
VSLOT_NUM 

Function Documentation

void cleanupmaterialslots ( )
void cleanupslots ( )

References loopv, and slots.

Referenced by cleanuptextures().

void cleanupvslots ( )

References loopv, and vslots.

Referenced by cleanuptextures().

void clearslots ( )
void compacteditvslots ( )
void compactmruvslots ( )
void compactvslot ( int &  index)

compacting mode: set index to compactvslots++ = vs.index, marking mode, just set vs.index

References assignvslot(), VSlot::index, markingvslots, and vslots.

Referenced by compacteditvslots().

void compactvslot ( VSlot vs)

References assignvslot(), and VSlot::index.

void compactvslots ( cube c,
int  n = 8 
)

Loops through all n subcubes of c, (reassigning vs.index to compactvslots++ in markmode and otherwise sets cubetexture to the new vslot) when texture was used.

References allocnodes, assignvslot(), compactvslots(), compactvslotsprogress, f(), VSlot::index, loopi(), loopj, markingvslots, inexor::rpc::min(), renderprogress(), cube::texture, and vslots.

Referenced by compacteditvslots(), compactvslots(), editvslot(), and save_world().

int compactvslots ( )
VSlot* editvslot ( const VSlot src,
const VSlot delta 
)

Select a VSlot beeing src but having modifications based on delta (??)

References allchanged(), clonedvslots, clonevslot(), compactvslots(), Slot::findvariant(), VSlot::slot, and vslots.

Referenced by remapvslot(), unpacktex(), and unpackvslots().

VSlot* emptyvslot ( Slot owner)

Wrapper around new VSlot to reuse unused dead vslots.

Warning
not threadsafe since it accesses slots and vslots globals.

References changed(), loopvrev, Slot::setvariantchain(), slots, and vslots.

Referenced by texture().

void loadlayermasks ( )

References loopv, and slots.

Referenced by calclight(), patchlight(), and previewblends().

MSlot& lookupmaterialslot ( int  slot,
bool  load = true 
)
Slot& lookupslot ( int  slot,
bool  load = true 
)
VSlot& lookupvslot ( int  slot,
bool  load = true 
)
void mergevslot ( VSlot dst,
const VSlot src,
const VSlot delta 
)
void packvslot ( vector< uchar > &  buf,
const VSlot src 
)
void packvslot ( vector< uchar > &  buf,
int  index 
)
void packvslot ( vector< uchar > &  buf,
const VSlot src 
)
void propagatevslot ( VSlot root,
int  changed 
)

Apply changes to all following neighbors of root.

Making it accordingly to roots vslot

Parameters
rootRoot of neighbours
changedincludes info about what changed

References VSlot::next, and propagatevslot().

bool texturedata ( ImageData d,
const char *  tname,
Slot::Tex tex = nullptr,
bool  msg = true,
int *  compress = nullptr 
)
void texturereset ( int  first,
int  num 
)

Resets all textures from the slots-stack.

Parameters
firstthe texturepos from whereon you want to reset
numthe number of slots you want to reset from thereon. All if 0 for example texturereset(0, 40); resets the first 40 textures

References game::allowedittoggle(), VSlot::changed, dummyslot, identflags, IDF_OVERRIDDEN, loopi(), VSlot::next, resetslotshader(), VSlot::slot, slots, Slot::variants, and vslots.

bool unpackvslot ( ucharbuf buf,
VSlot dst,
bool  delta 
)

Variable Documentation

vector<Slot *> slots
vector<VSlot *> vslots