Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Dec 18, 2011
1 parent bcd7c5e commit 72158eb
Show file tree
Hide file tree
Showing 7 changed files with 387 additions and 582 deletions.
67 changes: 51 additions & 16 deletions doomsday/engine/portable/include/p_surface.h
Expand Up @@ -35,25 +35,60 @@
/**
* Get the value of a surface property, selected by DMU_* name.
*/
int Surface_GetProperty(const surface_t* suf, setargs_t* args);
int Surface_GetProperty(const surface_t* surface, setargs_t* args);

/**
* Update the surface, property is selected by DMU_* name.
*/
int Surface_SetProperty(surface_t* suf, const setargs_t* args);

void Surface_Update(surface_t* suf);

boolean Surface_IsAttachedToMap(surface_t* suf);
boolean Surface_SetMaterial(surface_t* suf, material_t* mat);
boolean Surface_SetMaterialOffsetX(surface_t* suf, float x);
boolean Surface_SetMaterialOffsetY(surface_t* suf, float y);
boolean Surface_SetMaterialOffsetXY(surface_t* suf, float x, float y);
boolean Surface_SetColorR(surface_t* suf, float r);
boolean Surface_SetColorG(surface_t* suf, float g);
boolean Surface_SetColorB(surface_t* suf, float b);
boolean Surface_SetColorA(surface_t* suf, float a);
boolean Surface_SetColorRGBA(surface_t* suf, float r, float g, float b, float a);
boolean Surface_SetBlendMode(surface_t* suf, blendmode_t blendMode);
int Surface_SetProperty(surface_t* surface, const setargs_t* args);

/**
* Mark the surface as requiring a full update. To be called
* during engine reset.
*/
void Surface_Update(surface_t* surface);

/// @return @c true= Surface is drawable (i.e., a drawable Material is bound).
boolean Surface_IsDrawable(surface_t* surface);

/// @return @c true= Surface is owned by some element of the Map geometry.
boolean Surface_AttachedToMap(surface_t* surface);

/**
* Change Material bound to this Surface.
* @param mat New Material.
*/
boolean Surface_SetMaterial(surface_t* surface, material_t* material);

/**
* Change Material origin.
* @param x New X origin in map space.
* @param y New Y origin in map space.
*/
boolean Surface_SetMaterialOrigin(surface_t* surface, float x, float y);

/**
* Change Material origin X coordinate.
* @param x New X origin in map space.
*/
boolean Surface_SetMaterialOriginX(surface_t* surface, float x);

/**
* Change Material origin Y coordinate.
* @param y New Y origin in map space.
*/
boolean Surface_SetMaterialOriginY(surface_t* surface, float y);

boolean Surface_SetColorR(surface_t* surface, float red);
boolean Surface_SetColorG(surface_t* surface, float green);
boolean Surface_SetColorB(surface_t* surface, float blue);
boolean Surface_SetColorA(surface_t* surface, float alpha);
boolean Surface_SetColorRGBA(surface_t* surface, float red, float green, float blue, float alpha);

/**
* Change blendmode.
* @param blendMode New blendmode.
*/
boolean Surface_SetBlendMode(surface_t* surface, blendmode_t blendMode);

#endif /* LIBDENG_MAP_SURFACE_H */
10 changes: 8 additions & 2 deletions doomsday/engine/portable/include/rend_main.h
Expand Up @@ -77,8 +77,14 @@ void Rend_ModelViewMatrix(boolean use_angles);
float Rend_PointDist3D(const float c[3]);
void Rend_ApplyTorchLight(float* color, float distance);

void Rend_ApplyLightAdaptation(float* lightvalue);
float Rend_GetLightAdaptVal(float lightvalue);
/**
* Apply range compression delta to @a lightValue.
* @param lightValue Address of the value for adaptation.
*/
void Rend_ApplyLightAdaptation(float* lightValue);

/// Same as Rend_ApplyLightAdaptation except the delta is returned.
float Rend_GetLightAdaptVal(float lightvalue);

void Rend_CalcLightModRange(void);

Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/dam_file.c
Expand Up @@ -489,7 +489,7 @@ static void readSide(const gamemap_t *map, uint idx)
suf->normal[VZ] = readFloat();
offset[VX] = readFloat();
offset[VY] = readFloat();
Surface_SetMaterialOffsetXY(suf, offset[VX], offset[VY]);
Surface_SetMaterialOrigin(suf, offset[VX], offset[VY]);
rgba[CR] = readFloat();
rgba[CG] = readFloat();
rgba[CB] = readFloat();
Expand Down Expand Up @@ -638,7 +638,7 @@ static void readSector(const gamemap_t *map, uint idx)
p->surface.normal[VZ] = readFloat();
offset[VX] = readFloat();
offset[VY] = readFloat();
Surface_SetMaterialOffsetXY(&p->surface, offset[VX], offset[VY]);
Surface_SetMaterialOrigin(&p->surface, offset[VX], offset[VY]);
rgba[CR] = readFloat();
rgba[CG] = readFloat();
rgba[CB] = readFloat();
Expand Down
8 changes: 4 additions & 4 deletions doomsday/engine/portable/src/edit_map.c
Expand Up @@ -2061,15 +2061,15 @@ uint MPE_SidedefCreate(uint sector, short flags,
s->sector = (sector == 0? NULL: map->sectors[sector-1]);

Surface_SetMaterial(&s->SW_topsurface, Materials_ToMaterial(topMaterial));
Surface_SetMaterialOffsetXY(&s->SW_topsurface, topOffsetX, topOffsetY);
Surface_SetMaterialOrigin(&s->SW_topsurface, topOffsetX, topOffsetY);
Surface_SetColorRGBA(&s->SW_topsurface, topRed, topGreen, topBlue, 1);

Surface_SetMaterial(&s->SW_middlesurface, Materials_ToMaterial(middleMaterial));
Surface_SetMaterialOffsetXY(&s->SW_middlesurface, middleOffsetX, middleOffsetY);
Surface_SetMaterialOrigin(&s->SW_middlesurface, middleOffsetX, middleOffsetY);
Surface_SetColorRGBA(&s->SW_middlesurface, middleRed, middleGreen, middleBlue, middleAlpha);

Surface_SetMaterial(&s->SW_bottomsurface, Materials_ToMaterial(bottomMaterial));
Surface_SetMaterialOffsetXY(&s->SW_bottomsurface, bottomOffsetX, bottomOffsetY);
Surface_SetMaterialOrigin(&s->SW_bottomsurface, bottomOffsetX, bottomOffsetY);
Surface_SetColorRGBA(&s->SW_bottomsurface, bottomRed, bottomGreen, bottomBlue, 1);

return s->buildData.index;
Expand Down Expand Up @@ -2226,7 +2226,7 @@ uint MPE_PlaneCreate(uint sector, float height, materialid_t material,
pln->height = height;
Surface_SetMaterial(&pln->surface, Materials_ToMaterial(material));
Surface_SetColorRGBA(&pln->surface, r, g, b, a);
Surface_SetMaterialOffsetXY(&pln->surface, matOffsetX, matOffsetY);
Surface_SetMaterialOrigin(&pln->surface, matOffsetX, matOffsetY);
V3_Set(pln->PS_normal, normalX, normalY, normalZ);
V3_Normalize(pln->PS_normal);
V3_BuildTangents(pln->PS_tangent, pln->PS_bitangent, pln->PS_normal);
Expand Down

0 comments on commit 72158eb

Please sign in to comment.