Skip to content

Commit

Permalink
Map Renderer|Client: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Sep 2, 2013
1 parent 6cb0046 commit be60405
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 114 deletions.
60 changes: 30 additions & 30 deletions doomsday/client/include/render/lumobj.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/** @file render/lumobj.h Luminous Object Management
* @ingroup render
/** @file lumobj.h Luminous object management.
*
* @author Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @author Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -19,61 +18,62 @@
* 02110-1301 USA</small>
*/

#ifndef DENG_RENDER_LUMINOUS_H
#define DENG_RENDER_LUMINOUS_H
#ifndef DENG_CLIENT_RENDER_LUMINOUS_H
#define DENG_CLIENT_RENDER_LUMINOUS_H

#include <de/Matrix>
#include <de/Vector>

#include "api_gl.h"

#include "dd_types.h"
#include "color.h"
#include "resource/r_data.h"
#include "api_gl.h" // DGLuint
#include "world/map.h"

class BspLeaf;

// Luminous object types.
typedef enum {
enum lumtype_t
{
LT_OMNI, ///< Omni (spherical) light.
LT_PLANE ///< Planar light.
} lumtype_t;

// Helper macros for accessing lum data.
#define LUM_OMNI(x) (&((x)->data.omni))
#define LUM_PLANE(x) (&((x)->data.plane))
};

typedef struct lumobj_s {
struct lumobj_t
{
lumtype_t type;
coord_t origin[3]; // Center of the obj.
coord_t origin[3]; ///< Position in the map coordinate space.
BspLeaf *bspLeaf;
coord_t maxDistance;
void *decorSource; // decorsource_t ptr, else @c NULL.
void *decorSource; ///< Source of the light (if any).

union lumobj_data_u {
struct lumobj_omni_s {
float color[3];
coord_t radius; // Radius for this omnilight source.
coord_t zOff; // Offset to center from pos[VZ].
DGLuint tex; // Lightmap texture.
DGLuint floorTex, ceilTex; // Lightmaps for floor/ceil.
coord_t radius; ///< Radius for this omnilight source.
coord_t zOff; ///< Offset to center from pos[VZ].
DGLuint tex; ///< Primary lightmap texture.
DGLuint floorTex; ///< Floor lightmap (if any).
DGLuint ceilTex; ///< Ceiling lightmap (if any).
} omni;
struct lumobj_plane_s {
float color[3];
float intensity;
float normal[3];
} plane;
} data;
} lumobj_t;
};

// Helper macros for accessing lum data.
#define LUM_OMNI(x) (&((x)->data.omni))
#define LUM_PLANE(x) (&((x)->data.plane))

/**
* Dynlight stores a luminous object => surface projection.
*/
typedef struct {
struct dynlight_t
{
DGLuint texture;
float s[2], t[2];
de::Vector4f color;
} dynlight_t;
};

DENG_EXTERN_C boolean loInited;

Expand Down Expand Up @@ -130,10 +130,10 @@ lumobj_t *LO_GetLuminous(uint idx);
uint LO_ToIndex(lumobj_t const *lum);

/// @return @c true if the lumobj is clipped for the viewer.
boolean LO_IsClipped(uint idx, int i);
bool LO_IsClipped(uint idx, int i);

/// @return @c true if the lumobj is hidden for the viewer.
boolean LO_IsHidden(uint idx, int i);
bool LO_IsHidden(uint idx, int i);

/// @return Approximated distance between the lumobj and the viewer.
coord_t LO_DistanceToViewer(uint idx, int i);
Expand Down Expand Up @@ -235,4 +235,4 @@ int LO_IterateProjections(uint listIdx, int (*callback) (dynlight_t const *, voi

void LO_DrawLumobjs();

#endif // DENG_RENDER_LUMINOUS_H
#endif // DENG_CLIENT_RENDER_LUMINOUS_H
5 changes: 3 additions & 2 deletions doomsday/client/include/world/p_objlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#ifdef __CLIENT__

class BspLeaf;
struct lumobj_t;

enum objtype_t
{
Expand Down Expand Up @@ -67,7 +68,7 @@ void R_ClearObjlinksForFrame();
void R_ObjlinkCreate(struct mobj_s &mobj);

/// @copydoc R_ObjlinkCreate()
void R_ObjlinkCreate(struct lumobj_s &lumobj);
void R_ObjlinkCreate(lumobj_t &lumobj);

/**
* To be called at the beginning of a render frame to link all objects
Expand All @@ -87,7 +88,7 @@ void R_InitForBspLeaf(BspLeaf &bspLeaf);
*/
void R_LinkObjToBspLeaf(BspLeaf &bspLeaf, struct mobj_s &mobj);
/// @copydoc R_LinkObjToBspLeaf()
void R_LinkObjToBspLeaf(BspLeaf &bspLeaf, struct lumobj_s &lumobj);
void R_LinkObjToBspLeaf(BspLeaf &bspLeaf, lumobj_t &lumobj);

/**
* Traverse the list of objects of the specified @a type which have been linked
Expand Down
Loading

0 comments on commit be60405

Please sign in to comment.