World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Класс RenderBase

#include <RenderBase.h>

+ Граф наследования:RenderBase:
+ Граф связей класса RenderBase:

Открытые члены

 RenderBase ()
 
virtual bool Initialize (OSWindow *window)
 
virtual void TransformBillboardsAndSetPalettesODM ()
 
virtual void DrawSpriteObjects_ODM ()
 
virtual void MakeParticleBillboardAndPush (SoftwareBillboard *a2, Texture *texture, unsigned int uDiffuse, int angle)
 
virtual HWLTextureLoadHwlBitmap (const String &name)
 
virtual HWLTextureLoadHwlSprite (const String &name)
 
- Открытые члены унаследованные от IRender
 IRender ()
 
virtual ~IRender ()
 
virtual bool Configure (std::shared_ptr< const IRenderConfig > config)
 
virtual TextureCreateTexture_ColorKey (const String &name, uint16_t colorkey)=0
 
virtual TextureCreateTexture_Solid (const String &name)=0
 
virtual TextureCreateTexture_Alpha (const String &name)=0
 
virtual TextureCreateTexture_PCXFromFile (const String &name)=0
 
virtual TextureCreateTexture_PCXFromIconsLOD (const String &name)=0
 
virtual TextureCreateTexture_PCXFromNewLOD (const String &name)=0
 
virtual TextureCreateTexture_Blank (unsigned int width, unsigned int height, IMAGE_FORMAT format, const void *pixels=nullptr)=0
 
virtual TextureCreateTexture (const String &name)=0
 
virtual TextureCreateSprite (const String &name, unsigned int palette_id, unsigned int lod_sprite_id)=0
 
virtual void ClearBlack ()=0
 
virtual void PresentBlackScreen ()=0
 
virtual void SaveWinnersCertificate (const char *a1)=0
 
virtual void ClearTarget (unsigned int uColor)=0
 
virtual void Present ()=0
 
virtual bool InitializeFullscreen ()=0
 
virtual void CreateZBuffer ()=0
 
virtual void Release ()=0
 
virtual bool SwitchToWindow ()=0
 
virtual void RasterLine2D (int uX, int uY, int uZ, int uW, uint16_t uColor)=0
 
virtual void ClearZBuffer (int a2, int a3)=0
 
virtual void RestoreFrontBuffer ()=0
 
virtual void RestoreBackBuffer ()=0
 
virtual void BltBackToFontFast (int a2, int a3, Rect *a4)=0
 
virtual void BeginSceneD3D ()=0
 
virtual unsigned int GetActorTintColor (int DimLevel, int tint, float WorldViewX, int a5, RenderBillboard *Billboard)=0
 
virtual void DrawPolygon (struct Polygon *a3)=0
 
virtual void DrawTerrainPolygon (struct Polygon *a4, bool transparent, bool clampAtTextureBorders)=0
 
virtual void DrawIndoorPolygon (unsigned int uNumVertices, struct BLVFace *a3, int uPackedID, unsigned int uColor, int a8)=0
 
virtual void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene ()=0
 
virtual void DrawBillboard_Indoor (SoftwareBillboard *pSoftBillboard, RenderBillboard *billboard)=0
 
virtual void _4A4CC9_AddSomeBillboard (struct SpellFX_Billboard *a1, int diffuse)=0
 
virtual void DrawBillboardList_BLV ()=0
 
virtual void DrawProjectile (float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, Texture *texture)=0
 
virtual void RemoveTextureFromDevice (Texture *texture)=0
 
virtual bool MoveTextureToDevice (Texture *texture)=0
 
virtual void Update_Texture (Texture *texture)=0
 
virtual void DeleteTexture (Texture *texture)=0
 
virtual void BeginScene ()=0
 
virtual void EndScene ()=0
 
virtual void ScreenFade (unsigned int color, float t)=0
 
virtual void SetUIClipRect (unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW)=0
 
virtual void ResetUIClipRect ()=0
 
virtual void DrawTextureNew (float u, float v, Image *)=0
 
virtual void DrawTextureAlphaNew (float u, float v, Image *)=0
 
virtual void DrawTextureCustomHeight (float u, float v, Image *, int height)=0
 
virtual void DrawTextureOffset (int x, int y, int offset_x, int offset_y, Image *)=0
 
virtual void DrawImage (Image *, const Rect &rect)=0
 
virtual void ZBuffer_Fill_2 (signed int a2, signed int a3, Image *pTexture, int a5)=0
 
virtual void ZDrawTextureAlpha (float u, float v, Image *pTexture, int zVal)=0
 
virtual void BlendTextures (int a2, int a3, Image *a4, Image *a5, int t, int start_opacity, int end_opacity)=0
 
virtual void TexturePixelRotateDraw (float u, float v, Image *img, int time)=0
 
virtual void DrawMonsterPortrait (Rect rc, SpriteFrame *Portrait_Sprite, int Y_Offset)=0
 
virtual void DrawMasked (float u, float v, Image *img, unsigned int color_dimming_level, uint16_t mask)=0
 
virtual void DrawTextureGrayShade (float u, float v, Image *a4)=0
 
virtual void DrawTransparentRedShade (float u, float v, Image *a4)=0
 
virtual void DrawTransparentGreenShade (float u, float v, Image *pTexture)=0
 
virtual void DrawFansTransparent (const RenderVertexD3D3 *vertices, unsigned int num_vertices)=0
 
virtual void DrawTextAlpha (int x, int y, unsigned char *font_pixels, int a5, unsigned int uFontHeight, uint8_t *pPalette, bool present_time_transparency)=0
 
virtual void DrawText (int uOutX, int uOutY, uint8_t *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, uint8_t *pFontPalette, uint16_t uFaceColor, uint16_t uShadowColor)=0
 
virtual void FillRectFast (unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16)=0
 
virtual void DrawBuildingsD3D ()=0
 
virtual void DrawIndoorSky (unsigned int uNumVertices, unsigned int uFaceID=0)=0
 
virtual void DrawOutdoorSkyD3D ()=0
 
virtual void PrepareDecorationsRenderList_ODM ()=0
 
virtual void RenderTerrainD3D ()=0
 
virtual bool AreRenderSurfacesOk ()=0
 
virtual ImageTakeScreenshot (unsigned int width, unsigned int height)=0
 
virtual void SaveScreenshot (const String &filename, unsigned int width, unsigned int height)=0
 
virtual void PackScreenshot (unsigned int width, unsigned int height, void *out_data, unsigned int data_size, unsigned int *screenshot_size)=0
 
virtual void SavePCXScreenshot ()=0
 
virtual int GetActorsInViewport (int pDepth)=0
 
virtual void BeginLightmaps ()=0
 
virtual void EndLightmaps ()=0
 
virtual void BeginLightmaps2 ()=0
 
virtual void EndLightmaps2 ()=0
 
virtual bool DrawLightmap (struct Lightmap *pLightmap, struct Vec3_float_ *pColorMult, float z_bias)=0
 
virtual void BeginDecals ()=0
 
virtual void EndDecals ()=0
 
virtual void DrawDecal (struct Decal *pDecal, float z_bias)=0
 
virtual void do_draw_debug_line_d3d (const RenderVertexD3D3 *pLineBegin, signed int sDiffuseBegin, const RenderVertexD3D3 *pLineEnd, signed int sDiffuseEnd, float z_stuff)=0
 
virtual void DrawLines (const RenderVertexD3D3 *vertices, unsigned int num_vertices)=0
 
virtual void DrawSpecialEffectsQuad (const RenderVertexD3D3 *vertices, Texture *texture)=0
 
virtual void am_Blt_Chroma (struct Rect *pSrcRect, struct Point *pTargetPoint, int a3, int blend_mode)=0
 
void ToggleTint ()
 
void ToggleColoredLights ()
 
void SetUsingSpecular (bool is_using_specular)
 
void SetUsingFog (bool is_using_fog)
 
bool IsUsingSpecular () const
 
virtual void WritePixel16 (int x, int y, uint16_t color)=0
 
virtual unsigned int GetRenderWidth () const =0
 
virtual unsigned int GetRenderHeight () const =0
 

Защищенные члены

unsigned int Billboard_ProbablyAddToListAndSortByZOrder (float z)
 
void TransformBillboard (SoftwareBillboard *a2, RenderBillboard *pBillboard)
 
void PostInitialization ()
 

Защищенные данные

OSWindowwindow
 
HWLContainer pD3DBitmaps
 
HWLContainer pD3DSprites
 

Дополнительные унаследованные члены

- Открытые атрибуты унаследованные от IRender
std::shared_ptr< const IRenderConfigconfig
 
int * pActiveZBuffer
 
uint32_t uFogColor
 
unsigned int pHDWaterBitmapIDs [7]
 
int hd_water_current_frame
 
int hd_water_tile_id
 
Texturehd_water_tile_anim [7]
 
void(* pBeforePresentFunction )()
 
RenderBillboardD3D pBillboardRenderListD3D [1000]
 
unsigned int uNumBillboardsToDraw
 
Loglog = nullptr
 
DecalBuilderdecal_builder = nullptr
 
SpellFxRendererspell_fx_renderer = nullptr
 
LightmapBuilderlightmap_builder = nullptr
 
ParticleEngineparticle_engine = nullptr
 
Visvis = nullptr
 

Подробное описание

См. определение в файле RenderBase.h строка 6

Конструктор(ы)

◆ RenderBase()

RenderBase::RenderBase ( )
inline

См. определение в файле RenderBase.h строка 8

9  : IRender(), window(nullptr) {
10  }

Методы

◆ Initialize()

bool RenderBase::Initialize ( OSWindow window)
virtual

Замещает IRender.

Переопределяется в Render и RenderOpenGL.

См. определение в файле RenderBase.cpp строка 22

22  {
23  if (!pD3DBitmaps.Open(MakeDataPath("data\\d3dbitmap.hwl"))) {
24  return false;
25  }
26  if (!pD3DSprites.Open(MakeDataPath("data\\d3dsprite.hwl"))) {
27  return false;
28  }
29 
30  window = window_;
31  if (window == nullptr) {
32  return false;
33  }
34 
35  return true;
36 }

Перекрестные ссылки MakeDataPath(), HWLContainer::Open(), pD3DBitmaps и pD3DSprites.

Используется в RenderOpenGL::Initialize() и Render::Initialize().

+ Граф вызовов:
+ Граф вызова функции:

◆ TransformBillboardsAndSetPalettesODM()

void RenderBase::TransformBillboardsAndSetPalettesODM ( )
virtual

Замещает IRender.

См. определение в файле RenderBase.cpp строка 231

231  {
232  SoftwareBillboard billboard = {0};
233  billboard.sParentBillboardID = -1;
234  // billboard.pTarget = render->pTargetSurface;
235  billboard.pTargetZ = render->pActiveZBuffer;
236  // billboard.uTargetPitch = render->uTargetSurfacePitch;
237  billboard.uViewportX = pViewport->uViewportTL_X;
238  billboard.uViewportY = pViewport->uViewportTL_Y;
239  billboard.uViewportZ = pViewport->uViewportBR_X - 1;
240  billboard.uViewportW = pViewport->uViewportBR_Y;
242 
243  for (unsigned int i = 0; i < ::uNumBillboardsToDraw; ++i) {
244  auto p = &pBillboardRenderList[i];
245  if (p->hwsprite) {
246  billboard.screen_space_x = p->screen_space_x;
247  billboard.screen_space_y = p->screen_space_y;
248  billboard.screen_space_z = p->screen_space_z;
249  billboard.sParentBillboardID = i;
251  p->screenspace_projection_factor_x;
253  p->screenspace_projection_factor_y;
254  billboard.sTintColor = p->sTintColor;
255  billboard.object_pid = p->object_pid;
256  billboard.uFlags = p->field_1E;
257 
258  TransformBillboard(&billboard, p);
259  } else {
260  __debugbreak();
261  }
262  }
263 }

Перекрестные ссылки __debugbreak(), SoftwareBillboard::object_pid, pBillboardRenderList, pODMRenderParams, SoftwareBillboard::pTargetZ, pViewport, render, SoftwareBillboard::screen_space_x, SoftwareBillboard::screen_space_y, SoftwareBillboard::screen_space_z, SoftwareBillboard::screenspace_projection_factor_x, SoftwareBillboard::screenspace_projection_factor_y, SoftwareBillboard::sParentBillboardID, SoftwareBillboard::sTintColor, TransformBillboard(), SoftwareBillboard::uFlags, ODMRenderParams::uNumBillboards, IRender::uNumBillboardsToDraw, Viewport::uViewportBR_X, Viewport::uViewportBR_Y, Viewport::uViewportTL_X, Viewport::uViewportTL_Y, SoftwareBillboard::uViewportW, SoftwareBillboard::uViewportX, SoftwareBillboard::uViewportY и SoftwareBillboard::uViewportZ.

+ Граф вызовов:

◆ DrawSpriteObjects_ODM()

void RenderBase::DrawSpriteObjects_ODM ( )
virtual

Замещает IRender.

См. определение в файле RenderBase.cpp строка 109

109  {
110  for (unsigned int i = 0; i < uNumSpriteObjects; ++i) {
111  SpriteObject *object = &pSpriteObjects[i];
112  // auto v0 = (char *)&pSpriteObjects[i].uSectorID;
113  // v0 = (char *)&pSpriteObjects[0].uSectorID;
114  // do
115  //{
116 
117  // if (object->uType == 601) __debugbreak();
118 
119  if (!object->uObjectDescID) { // item probably pciked up - this also gets wiped at end of sprite anims/ particle effects
120  // __debugbreak();
121  continue;
122  }
123 
124 
125  if (!object->HasSprite()) {
126  // __debugbreak();
127  continue;
128  }
129 
130  // v1 = &pObjectList->pObjects[*((short *)v0 - 13)];
131  // if ( !(v1->uFlags & 1) )
132  //{
133  // v2 = *((short *)v0 - 14)
134  // v2 = object->uType;
135 
136  // render as sprte 500 - 9081
137 
138  if (spell_fx_renderer->RenderAsSprite(object) || ((object->uType < 1000 || object->uType >= 10000) && (object->uType < 500 || object->uType >= 600))) {
139  // a5 = *(short *)v0;
140  int x = object->vPosition.x;
141  int y = object->vPosition.y;
142  int z = object->vPosition.z;
143  SpriteFrame *frame = object->GetSpriteFrame();
144 
145  if (frame->icon_name == "null") {
146  __debugbreak();
147  continue;
148  }
149 
150  int a6 = frame->uGlowRadius * object->field_22_glow_radius_multiplier;
151 
152  // sprite angle to camera
153  unsigned int v6 = stru_5C6E00->Atan2(
154  object->vPosition.x - pIndoorCameraD3D->vPartyPos.x,
155  object->vPosition.y - pIndoorCameraD3D->vPartyPos.y);
156  // LOWORD(v7) = object->uFacing;
157  // v8 = v36;
158  int v9 = ((int)(stru_5C6E00->uIntegerPi + ((int)stru_5C6E00->uIntegerPi >> 3) +
159  object->uFacing - v6) >> 8) & 7;
160 
162  // error catching
163  if (frame->hw_sprites[v9]->texture->GetHeight() == 0 || frame->hw_sprites[v9]->texture->GetWidth() == 0)
164  __debugbreak();
165 
166  if (frame->uFlags & 0x20) {
167  // v8 = v36;
168  z -= fixpoint_mul(frame->scale._internal, frame->hw_sprites[v9]->uBufferHeight) / 2;
169  }
170  int16_t v46 = 0;
171  if (frame->uFlags & 2) v46 = 2;
172  // v11 = (int *)(256 << device_caps);
173  if ((256 << v9) & frame->uFlags) v46 |= 4;
174  if (frame->uFlags & 0x40000) v46 |= 0x40;
175  if (frame->uFlags & 0x20000) v46 |= 0x80;
176  if (a6) {
177  pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFF, 0xFF, 0xFF, _4E94D3_light_type);
178  }
179 
180  int view_x = 0;
181  int view_y = 0;
182  int view_z = 0;
183 
184  bool visible = pIndoorCameraD3D->ViewClip(x, y, z, &view_x, &view_y, &view_z);
185 
186  if (visible) {
187  // if (abs(view_x) >= abs(view_y)) {
188  int projected_x = 0;
189  int projected_y = 0;
190  pIndoorCameraD3D->Project(view_x, view_y, view_z, &projected_x, &projected_y);
191 
192  object->uAttributes |= 1;
196 
199 
204 
208 
212  // if (!(object->uAttributes & 0x20)) {
213  // if (!pRenderD3D) {
214  // __debugbreak();
215  // pBillboardRenderList[::uNumBillboardsToDraw].screen_space_z
216  // = 0;
217  // pBillboardRenderList[::uNumBillboardsToDraw].object_pid
218  // = 0;
219  // }
220  // }
221 
222  assert(::uNumBillboardsToDraw < 500);
225  // }
226  }
227  }
228  }
229 }

Перекрестные ссылки _4E94D3_light_type, __debugbreak(), fixed::_internal, LightsStack_MobileLight_::AddLight(), stru193_math::Atan2(), RenderBillboard::dimming_level, RenderBillboard::field_1E, fixpoint_mul(), fixed::GetFloat(), Image::GetHeight(), Image::GetWidth(), SpriteFrame::hw_sprites, RenderBillboard::hwsprite, SpriteFrame::icon_name, ODMRenderParams::int_fov_rad, OBJECT_Item, RenderBillboard::object_pid, pBillboardRenderList, pIndoorCameraD3D, pMobileLightsStack, pODMRenderParams, IndoorCameraD3D::Project(), RenderBillboard::pSpriteFrame, pSpriteObjects, SpellFxRenderer::RenderAsSprite(), SpriteFrame::scale, RenderBillboard::screen_space_x, RenderBillboard::screen_space_y, RenderBillboard::screen_space_z, RenderBillboard::screenspace_projection_factor_x, RenderBillboard::screenspace_projection_factor_y, IRender::spell_fx_renderer, RenderBillboard::sTintColor, stru_5C6E00, Sprite::texture, Sprite::uBufferHeight, SpriteFrame::uFlags, SpriteFrame::uGlowRadius, RenderBillboard::uIndoorSectorID, stru193_math::uIntegerPi, IRender::uNumBillboardsToDraw, uNumSpriteObjects, uNumSpritesDrawnThisFrame, RenderBillboard::uPalette, SpriteFrame::uPaletteIndex, IndoorCameraD3D::ViewClip(), IndoorCameraD3D::vPartyPos, RenderBillboard::world_x, RenderBillboard::world_y, RenderBillboard::world_z, Vec2< T >::x и Vec2< T >::y.

+ Граф вызовов:

◆ MakeParticleBillboardAndPush()

void RenderBase::MakeParticleBillboardAndPush ( SoftwareBillboard a2,
Texture texture,
unsigned int  uDiffuse,
int  angle 
)
virtual

Замещает IRender.

См. определение в файле RenderBase.cpp строка 377

380  {
381  unsigned int billboard_index = Billboard_ProbablyAddToListAndSortByZOrder(a2->screen_space_z);
382  RenderBillboardD3D *billboard = &pBillboardRenderListD3D[billboard_index];
383 
385  billboard->field_90 = a2->field_44;
386  billboard->screen_space_z = a2->screen_space_z;
387  billboard->object_pid = a2->object_pid;
388  billboard->sParentBillboardID = a2->sParentBillboardID;
389  billboard->texture = texture;
390  billboard->z_order = a2->screen_space_z;
391  billboard->uNumVertices = 4;
392 
393  float screenspace_projection_factor = a2->screenspace_projection_factor_x;
394 
395  float rhw = 1.f / a2->screen_space_z;
396  float z = 1.f - 1.f / (a2->screen_space_z * 1000.f / pIndoorCameraD3D->GetFarClip());
397 
398  float acos = (float)cos(angle);
399  float asin = (float)sin(angle);
400 
401  {
402  float v16 = -12.f;
403  float v17 = -12.f;
404  billboard->pQuads[0].pos.x = (acos * v16 - asin * v17) * screenspace_projection_factor + (float)a2->screen_space_x;
405  billboard->pQuads[0].pos.y = (acos * v17 + asin * v16 - 12.f) * screenspace_projection_factor + (float)a2->screen_space_y;
406  billboard->pQuads[0].pos.z = z;
407  billboard->pQuads[0].specular = 0;
408  billboard->pQuads[0].diffuse = uDiffuse;
409  billboard->pQuads[0].rhw = rhw;
410  billboard->pQuads[0].texcoord.x = 0.f;
411  billboard->pQuads[0].texcoord.y = 0.f;
412  }
413 
414  {
415  float v31 = -12;
416  float v32 = 12;
417  billboard->pQuads[1].pos.x = (acos * v31 - asin * v32) * screenspace_projection_factor + (float)a2->screen_space_x;
418  billboard->pQuads[1].pos.y = (acos * v32 + asin * v31 - 12.f) * screenspace_projection_factor + (float)a2->screen_space_y;
419  billboard->pQuads[1].pos.z = z;
420  billboard->pQuads[1].specular = 0;
421  billboard->pQuads[1].diffuse = uDiffuse;
422  billboard->pQuads[1].rhw = rhw;
423  billboard->pQuads[1].texcoord.x = 0.0;
424  billboard->pQuads[1].texcoord.y = 1.0;
425  }
426 
427  {
428  float v23 = 12;
429  float v24 = 12;
430  billboard->pQuads[2].pos.x = (acos * v23 - asin * v24) * screenspace_projection_factor + (float)a2->screen_space_x;
431  billboard->pQuads[2].pos.y = (acos * v24 + asin * v23 - 12.f) * screenspace_projection_factor + (float)a2->screen_space_y;
432  billboard->pQuads[2].pos.z = z;
433  billboard->pQuads[2].specular = 0;
434  billboard->pQuads[2].diffuse = uDiffuse;
435  billboard->pQuads[2].rhw = rhw;
436  billboard->pQuads[2].texcoord.x = 1.0;
437  billboard->pQuads[2].texcoord.y = 1.0;
438  }
439 
440  {
441  float v39 = 12;
442  float v40 = -12;
443  billboard->pQuads[3].pos.x = (acos * v39 - asin * v40) * screenspace_projection_factor + (float)a2->screen_space_x;
444  billboard->pQuads[3].pos.y = (acos * v40 + asin * v39 - 12.f) * screenspace_projection_factor + (float)a2->screen_space_y;
445  billboard->pQuads[3].pos.z = z;
446  billboard->pQuads[3].specular = 0;
447  billboard->pQuads[3].diffuse = uDiffuse;
448  billboard->pQuads[3].rhw = rhw;
449  billboard->pQuads[3].texcoord.x = 1.0;
450  billboard->pQuads[3].texcoord.y = 0.0;
451  }
452 }

Перекрестные ссылки Billboard_ProbablyAddToListAndSortByZOrder(), RenderVertexD3D3::diffuse, SoftwareBillboard::field_44, RenderBillboardD3D::field_90, IndoorCameraD3D::GetFarClip(), RenderBillboardD3D::object_pid, SoftwareBillboard::object_pid, RenderBillboardD3D::opacity, RenderBillboardD3D::Opaque_1, IRender::pBillboardRenderListD3D, pIndoorCameraD3D, RenderVertexD3D3::pos, RenderBillboardD3D::pQuads, RenderVertexD3D3::rhw, SoftwareBillboard::screen_space_x, SoftwareBillboard::screen_space_y, RenderBillboardD3D::screen_space_z, SoftwareBillboard::screen_space_z, SoftwareBillboard::screenspace_projection_factor_x, RenderBillboardD3D::sParentBillboardID, SoftwareBillboard::sParentBillboardID, RenderVertexD3D3::specular, RenderVertexD3D3::texcoord, RenderBillboardD3D::texture, RenderBillboardD3D::uNumVertices, Vec3_float_::x, Vec3_float_::y, Vec3_float_::z и RenderBillboardD3D::z_order.

+ Граф вызовов:

◆ LoadHwlBitmap()

HWLTexture * RenderBase::LoadHwlBitmap ( const String name)
virtual

Замещает IRender.

См. определение в файле RenderBase.cpp строка 454

454  {
455  return pD3DBitmaps.LoadTexture(name);
456 }

Перекрестные ссылки HWLContainer::LoadTexture() и pD3DBitmaps.

+ Граф вызовов:

◆ LoadHwlSprite()

HWLTexture * RenderBase::LoadHwlSprite ( const String name)
virtual

Замещает IRender.

См. определение в файле RenderBase.cpp строка 458

458  {
459  return pD3DSprites.LoadTexture(name);
460 }

Перекрестные ссылки HWLContainer::LoadTexture() и pD3DSprites.

+ Граф вызовов:

◆ Billboard_ProbablyAddToListAndSortByZOrder()

unsigned int RenderBase::Billboard_ProbablyAddToListAndSortByZOrder ( float  z)
protected

См. определение в файле RenderBase.cpp строка 49

49  {
50  if (uNumBillboardsToDraw >= 999) {
51  return 0;
52  }
53 
54  if (!uNumBillboardsToDraw) {
56  return 0;
57  }
58 
59  unsigned int v7 = 0;
60  for (int left = 0, right = uNumBillboardsToDraw;
61  left < right;) { // binsearch
62  v7 = left + (right - left) / 2;
64  right = v7;
65  else
66  left = v7 + 1;
67  }
68 
69  if (z > render->pBillboardRenderListD3D[v7].z_order) {
70  if (v7 == render->uNumBillboardsToDraw - 1) {
71  v7 = render->uNumBillboardsToDraw;
72  } else {
73  if (render->uNumBillboardsToDraw > v7) {
74  for (unsigned int i = 0; i < render->uNumBillboardsToDraw - v7;
75  i++) {
76  memcpy(&render->pBillboardRenderListD3D
77  [render->uNumBillboardsToDraw - i],
78  &render->pBillboardRenderListD3D
79  [render->uNumBillboardsToDraw - (i + 1)],
80  sizeof(render->pBillboardRenderListD3D
81  [render->uNumBillboardsToDraw - i]));
82  }
83  }
84  ++v7;
85  }
87  return v7;
88  }
89 
90  if (z <= render->pBillboardRenderListD3D[v7].z_order) {
91  if (render->uNumBillboardsToDraw > v7) {
92  for (unsigned int i = 0; i < render->uNumBillboardsToDraw - v7;
93  i++) {
94  memcpy(&render->pBillboardRenderListD3D
95  [render->uNumBillboardsToDraw - i],
96  &render->pBillboardRenderListD3D
97  [render->uNumBillboardsToDraw - (i + 1)],
98  sizeof(render->pBillboardRenderListD3D
99  [render->uNumBillboardsToDraw - i]));
100  }
101  }
103  return v7;
104  }
105 
106  return v7;
107 }

Перекрестные ссылки IRender::pBillboardRenderListD3D, render и IRender::uNumBillboardsToDraw.

Используется в Render::_4A4CC9_AddSomeBillboard(), RenderOpenGL::DrawBillboard_Indoor(), Render::DrawBillboard_Indoor(), MakeParticleBillboardAndPush() и TransformBillboard().

+ Граф вызова функции:

◆ TransformBillboard()

void RenderBase::TransformBillboard ( SoftwareBillboard a2,
RenderBillboard pBillboard 
)
protected

См. определение в файле RenderBase.cpp строка 277

278  {
279  Sprite *pSprite = pBillboard->hwsprite;
280  // error catching
281  if (pSprite->texture->GetHeight() == 0 || pSprite->texture->GetWidth() == 0)
282  __debugbreak();
283 
284  int dimming_level = pBillboard->dimming_level;
285 
286  unsigned int billboard_index = Billboard_ProbablyAddToListAndSortByZOrder(a2->screen_space_z);
287 
288  float v30 = a2->screenspace_projection_factor_x;
289  float v29 = a2->screenspace_projection_factor_y;
290 
291  unsigned int diffuse = ::GetActorTintColor(
292  dimming_level, 0, a2->screen_space_z, 0, pBillboard);
293  if (config->is_tinting && a2->sTintColor & 0x00FFFFFF) {
294  diffuse = BlendColors(a2->sTintColor, diffuse);
295  if (a2->sTintColor & 0xFF000000)
296  diffuse = 0x007F7F7F & ((unsigned int)diffuse >> 1);
297  }
298 
299  unsigned int specular = 0;
300  if (config->is_using_specular) {
301  specular = sub_47C3D7_get_fog_specular(0, 0, a2->screen_space_z);
302  }
303 
304  RenderBillboardD3D *billboard = &pBillboardRenderListD3D[billboard_index];
305 
306  float v14 = (float)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX);
307  float v15 = (float)((int)pSprite->uBufferHeight - pSprite->uAreaY);
308  if (a2->uFlags & 4) v14 *= -1.f;
309  billboard->pQuads[0].diffuse = diffuse;
310  billboard->pQuads[0].pos.x = (float)a2->screen_space_x - v14 * v30;
311  billboard->pQuads[0].pos.y = (float)a2->screen_space_y - v15 * v29;
312  billboard->pQuads[0].pos.z = 1.f - 1.f / (a2->screen_space_z * 1000.f / pIndoorCameraD3D->GetFarClip());
313  billboard->pQuads[0].rhw = 1.f / a2->screen_space_z;
314  billboard->pQuads[0].specular = specular;
315  billboard->pQuads[0].texcoord.x = 0.f;
316  billboard->pQuads[0].texcoord.y = 0.f;
317 
318  v14 = (float)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX);
319  v15 = (float)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY);
320  if (a2->uFlags & 4) v14 = v14 * -1.f;
321  billboard->pQuads[1].specular = specular;
322  billboard->pQuads[1].diffuse = diffuse;
323  billboard->pQuads[1].pos.x = (float)a2->screen_space_x - v14 * v30;
324  billboard->pQuads[1].pos.y = (float)a2->screen_space_y - v15 * v29;
325  billboard->pQuads[1].pos.z = 1.f - 1.f / (a2->screen_space_z * 1000.f / pIndoorCameraD3D->GetFarClip());
326  billboard->pQuads[1].rhw = 1.f / a2->screen_space_z;
327  billboard->pQuads[1].texcoord.x = 0.f;
328  billboard->pQuads[1].texcoord.y = 1.f;
329 
330  v14 = (float)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth);
331  v15 = (float)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY);
332  if (a2->uFlags & 4) v14 *= -1.f;
333  billboard->pQuads[2].diffuse = diffuse;
334  billboard->pQuads[2].specular = specular;
335  billboard->pQuads[2].pos.x = (float)a2->screen_space_x + v14 * v30;
336  billboard->pQuads[2].pos.y = (float)a2->screen_space_y - v15 * v29;
337  billboard->pQuads[2].pos.z = 1.f - 1.f / (a2->screen_space_z * 1000.f / pIndoorCameraD3D->GetFarClip());
338  billboard->pQuads[2].rhw = 1.f / a2->screen_space_z;
339  billboard->pQuads[2].texcoord.x = 1.f;
340  billboard->pQuads[2].texcoord.y = 1.f;
341 
342  v14 = (float)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth);
343  v15 = (float)((int)pSprite->uBufferHeight - pSprite->uAreaY);
344  if (a2->uFlags & 4) v14 *= -1.f;
345  billboard->pQuads[3].diffuse = diffuse;
346  billboard->pQuads[3].specular = specular;
347  billboard->pQuads[3].pos.x = (float)a2->screen_space_x + v14 * v30;
348  billboard->pQuads[3].pos.y = (float)a2->screen_space_y - v15 * v29;
349  billboard->pQuads[3].pos.z = 1.f - 1.f / (a2->screen_space_z * 1000.f / pIndoorCameraD3D->GetFarClip());
350  billboard->pQuads[3].rhw = 1.f / a2->screen_space_z;
351  billboard->pQuads[3].texcoord.x = 1.f;
352  billboard->pQuads[3].texcoord.y = 0.f;
353 
354  billboard->uNumVertices = 4;
355 
356  // error catching
357  if (pSprite->texture->GetHeight() == 0 || pSprite->texture->GetWidth() == 0)
358  __debugbreak();
359 
360  billboard->texture = pSprite->texture;
361  billboard->z_order = a2->screen_space_z;
362  billboard->field_90 = a2->field_44;
363  billboard->screen_space_z = a2->screen_space_z;
364  billboard->object_pid = a2->object_pid;
365  billboard->sParentBillboardID = a2->sParentBillboardID;
366 
367  if (a2->sTintColor & 0xFF000000)
369  else
371 }

Перекрестные ссылки __debugbreak(), Billboard_ProbablyAddToListAndSortByZOrder(), BlendColors(), RenderVertexD3D3::diffuse, RenderBillboard::dimming_level, SoftwareBillboard::field_44, RenderBillboardD3D::field_90, IRender::GetActorTintColor(), IndoorCameraD3D::GetFarClip(), Image::GetHeight(), Image::GetWidth(), RenderBillboard::hwsprite, RenderBillboardD3D::object_pid, SoftwareBillboard::object_pid, RenderBillboardD3D::opacity, RenderBillboardD3D::Opaque_3, IRender::pBillboardRenderListD3D, pIndoorCameraD3D, RenderVertexD3D3::pos, RenderBillboardD3D::pQuads, RenderVertexD3D3::rhw, SoftwareBillboard::screen_space_x, SoftwareBillboard::screen_space_y, RenderBillboardD3D::screen_space_z, SoftwareBillboard::screen_space_z, SoftwareBillboard::screenspace_projection_factor_x, SoftwareBillboard::screenspace_projection_factor_y, RenderBillboardD3D::sParentBillboardID, SoftwareBillboard::sParentBillboardID, RenderVertexD3D3::specular, SoftwareBillboard::sTintColor, sub_47C3D7_get_fog_specular(), RenderVertexD3D3::texcoord, Sprite::texture, RenderBillboardD3D::texture, RenderBillboardD3D::Transparent, Sprite::uAreaHeight, Sprite::uAreaWidth, Sprite::uAreaX, Sprite::uAreaY, Sprite::uBufferHeight, Sprite::uBufferWidth, SoftwareBillboard::uFlags, RenderBillboardD3D::uNumVertices, Vec3_float_::x, Vec3_float_::y, Vec3_float_::z и RenderBillboardD3D::z_order.

Используется в TransformBillboardsAndSetPalettesODM().

+ Граф вызовов:
+ Граф вызова функции:

◆ PostInitialization()

void RenderBase::PostInitialization ( )
protected

См. определение в файле RenderBase.cpp строка 38

38  {
39  if (!config->IsFullscreen()) {
40  // window->SetWindowedMode(game_width, game_height);
42  } else {
43  __debugbreak(); // check required
44  window->SetFullscreenMode();
46  }
47 }

Перекрестные ссылки __debugbreak(), IRender::InitializeFullscreen() и IRender::SwitchToWindow().

Используется в RenderOpenGL::Initialize() и Render::Initialize().

+ Граф вызовов:
+ Граф вызова функции:

Данные класса

◆ window

OSWindow* RenderBase::window
protected

См. определение в файле RenderBase.h строка 25

Используется в Render::InitializeFullscreen().

◆ pD3DBitmaps

HWLContainer RenderBase::pD3DBitmaps
protected

См. определение в файле RenderBase.h строка 32

Используется в Initialize(), LoadHwlBitmap() и Render::LoadHwlBitmap().

◆ pD3DSprites

HWLContainer RenderBase::pD3DSprites
protected

См. определение в файле RenderBase.h строка 33

Используется в Initialize(), LoadHwlSprite() и Render::LoadHwlSprite().


Объявления и описания членов классов находятся в файлах:
SpriteObject
Definition: SpriteObject.h:189
SpriteFrame::hw_sprites
Sprite * hw_sprites[8]
Definition: Sprites.h:46
RenderBillboard::hwsprite
Sprite * hwsprite
Definition: IRender.h:32
int16_t
signed __int16 int16_t
Definition: SDL_config.h:36
Image::GetHeight
unsigned int GetHeight()
Definition: Image.cpp:230
RenderBillboard::screen_space_x
int16_t screen_space_x
Definition: IRender.h:39
Vec2::x
T x
Definition: VectorTypes.h:12
SpriteFrame::uGlowRadius
int uGlowRadius
Definition: Sprites.h:49
ODMRenderParams::uNumBillboards
unsigned int uNumBillboards
Definition: IRender.h:90
SpriteFrame::icon_name
String icon_name
Definition: Sprites.h:43
right
GLdouble GLdouble right
Definition: SDL_opengl_glext.h:6106
pSpriteObjects
std::array< SpriteObject, MAX_SPRITE_OBJECTS > pSpriteObjects
Definition: SpriteObject.cpp:34
Viewport::uViewportTL_Y
int uViewportTL_Y
Definition: Viewport.h:23
RenderBillboard::uIndoorSectorID
int16_t uIndoorSectorID
Definition: IRender.h:34
OBJECT_Item
@ OBJECT_Item
Definition: Actor.h:66
Vec3_float_::x
float x
Definition: VectorTypes.h:89
RenderBillboardD3D::Opaque_1
@ Opaque_1
Definition: IRender.h:151
RenderVertexD3D3::pos
Vec3_float_ pos
Definition: IRender.h:130
_4E94D3_light_type
char _4E94D3_light_type
Definition: mm7_data.cpp:307
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:407
SpriteFrame::scale
fixed scale
Definition: Sprites.h:47
RenderBillboardD3D
Definition: IRender.h:138
RenderBase::TransformBillboard
void TransformBillboard(SoftwareBillboard *a2, RenderBillboard *pBillboard)
Definition: RenderBase.cpp:277
RenderBillboard::dimming_level
uint16_t dimming_level
Definition: IRender.h:43
SoftwareBillboard::screenspace_projection_factor_y
float screenspace_projection_factor_y
Definition: IRender.h:177
RenderBillboardD3D::field_90
int field_90
Definition: IRender.h:163
RenderBillboard::screen_space_z
int16_t screen_space_z
Definition: IRender.h:41
SoftwareBillboard::screenspace_projection_factor_x
float screenspace_projection_factor_x
Definition: IRender.h:176
RenderBillboard::world_z
int16_t world_z
Definition: IRender.h:38
RenderBillboardD3D::Transparent
@ Transparent
Definition: IRender.h:150
Sprite::uBufferHeight
int uBufferHeight
Definition: Sprites.h:32
SpriteFrame::uPaletteIndex
int uPaletteIndex
Definition: Sprites.h:51
texture
GLenum GLenum GLuint texture
Definition: SDL_opengl_glext.h:1181
RenderBillboardD3D::z_order
float z_order
Definition: IRender.h:161
SoftwareBillboard::field_44
int field_44
Definition: IRender.h:187
Sprite::texture
Texture * texture
Definition: Sprites.h:28
RenderBillboard::pSpriteFrame
SpriteFrame * pSpriteFrame
Definition: IRender.h:45
Vec3_float_::y
float y
Definition: VectorTypes.h:90
Vec3_float_::z
float z
Definition: VectorTypes.h:91
IRender::InitializeFullscreen
virtual bool InitializeFullscreen()=0
RenderBase::Billboard_ProbablyAddToListAndSortByZOrder
unsigned int Billboard_ProbablyAddToListAndSortByZOrder(float z)
Definition: RenderBase.cpp:49
Sprite
Definition: Sprites.h:10
IRender::GetActorTintColor
virtual unsigned int GetActorTintColor(int DimLevel, int tint, float WorldViewX, int a5, RenderBillboard *Billboard)=0
RenderVertexD3D3::texcoord
Vec2_float_ texcoord
Definition: IRender.h:134
HWLContainer::LoadTexture
HWLTexture * LoadTexture(const String &pName)
Definition: HWLContainer.cpp:88
RenderBillboard::field_1E
int16_t field_1E
Definition: IRender.h:35
Sprite::uAreaY
int uAreaY
Definition: Sprites.h:30
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
RenderVertexD3D3::rhw
float rhw
Definition: IRender.h:131
Image::GetWidth
unsigned int GetWidth()
Definition: Image.cpp:217
IndoorCameraD3D::vPartyPos
Vec3< int > vPartyPos
Definition: IndoorCameraD3D.h:253
Vec2::y
T y
Definition: VectorTypes.h:13
Sprite::uBufferWidth
int uBufferWidth
Definition: Sprites.h:31
Polygon::dimming_level
char dimming_level
Definition: Polygon.h:48
object
GLuint object
Definition: SDL_opengl_glext.h:6060
SoftwareBillboard
Definition: IRender.h:170
RenderBillboard::uPalette
int16_t uPalette
Definition: IRender.h:33
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11093
RenderBillboard::object_pid
uint16_t object_pid
Definition: IRender.h:42
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
RenderBase::pD3DBitmaps
HWLContainer pD3DBitmaps
Definition: RenderBase.h:32
SoftwareBillboard::screen_space_z
short screen_space_z
Definition: IRender.h:175
BlendColors
unsigned int BlendColors(unsigned int a1, unsigned int a2)
Definition: RenderBase.cpp:265
IndoorCameraD3D::ViewClip
bool ViewClip(int x, int y, int z, int *transformed_x, int *transformed_y, int *transformed_z, bool dont_show=false)
Definition: IndoorCameraD3D.cpp:172
RenderBase::window
OSWindow * window
Definition: RenderBase.h:25
fixed::_internal
int32_t _internal
Definition: OurMath.h:73
Sprite::uAreaWidth
int uAreaWidth
Definition: Sprites.h:33
RenderVertexD3D3::diffuse
unsigned int diffuse
Definition: IRender.h:132
IRender::pBillboardRenderListD3D
RenderBillboardD3D pBillboardRenderListD3D[1000]
Definition: IRender.h:428
IndoorCameraD3D::Project
void Project(int x, int y, int z, int *screenspace_x, int *screenspace_y)
Definition: IndoorCameraD3D.cpp:1137
fixpoint_mul
__int64 fixpoint_mul(int a1, int a2)
Definition: OurMath.cpp:138
Viewport::uViewportBR_X
int uViewportBR_X
Definition: Viewport.h:24
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
RenderBillboardD3D::uNumVertices
unsigned int uNumVertices
Definition: IRender.h:159
SoftwareBillboard::screen_space_x
int screen_space_x
Definition: IRender.h:173
RenderBillboardD3D::opacity
OpacityType opacity
Definition: IRender.h:162
HWLContainer::Open
bool Open(const String &pFilename)
Definition: HWLContainer.cpp:28
IRender::IRender
IRender()
Definition: IRender.h:197
Viewport::uViewportBR_Y
int uViewportBR_Y
Definition: Viewport.h:25
RenderBillboardD3D::texture
Texture * texture
Definition: IRender.h:158
SoftwareBillboard::uViewportY
unsigned int uViewportY
Definition: IRender.h:184
RenderBillboard::screenspace_projection_factor_y
float screenspace_projection_factor_y
Definition: IRender.h:28
SpellFxRenderer::RenderAsSprite
bool RenderAsSprite(struct SpriteObject *a2)
Definition: SpellFxRenderer.cpp:671
RenderBillboardD3D::object_pid
unsigned short object_pid
Definition: IRender.h:165
SoftwareBillboard::uViewportX
unsigned int uViewportX
Definition: IRender.h:183
RenderBillboard::screen_space_y
int16_t screen_space_y
Definition: IRender.h:40
SoftwareBillboard::screen_space_y
int screen_space_y
Definition: IRender.h:174
pViewport
struct Viewport * pViewport
Definition: mm7_data.cpp:21
pODMRenderParams
ODMRenderParams * pODMRenderParams
Definition: Outdoor.cpp:49
uNumSpriteObjects
size_t uNumSpriteObjects
Definition: SpriteObject.cpp:33
IRender::SwitchToWindow
virtual bool SwitchToWindow()=0
IRender::uNumBillboardsToDraw
unsigned int uNumBillboardsToDraw
Definition: IRender.h:429
RenderBillboardD3D::Opaque_3
@ Opaque_3
Definition: IRender.h:153
IRender::spell_fx_renderer
SpellFxRenderer * spell_fx_renderer
Definition: IRender.h:433
stru193_math::Atan2
unsigned int Atan2(int x, int y)
Definition: OurMath.cpp:46
name
EGLImageKHR EGLint * name
Definition: SDL_egl.h:1497
Sprite::uAreaX
int uAreaX
Definition: Sprites.h:29
RenderBillboard::world_y
int16_t world_y
Definition: IRender.h:37
SoftwareBillboard::uViewportW
unsigned int uViewportW
Definition: IRender.h:186
MakeDataPath
std::string MakeDataPath(const char *file_rel_path)
Definition: Engine.cpp:126
SpriteFrame
Definition: Sprites.h:39
SoftwareBillboard::uViewportZ
unsigned int uViewportZ
Definition: IRender.h:185
SoftwareBillboard::uFlags
unsigned int uFlags
Definition: IRender.h:181
SoftwareBillboard::sParentBillboardID
int sParentBillboardID
Definition: IRender.h:188
__debugbreak
void __cdecl __debugbreak(void)
fixed::GetFloat
float GetFloat() const
Definition: OurMath.h:37
uNumSpritesDrawnThisFrame
int uNumSpritesDrawnThisFrame
Definition: RenderOpenGL.cpp:56
stru_5C6E00
struct stru193_math * stru_5C6E00
Definition: mm7_data.cpp:19
angle
GLfloat angle
Definition: SDL_opengl_glext.h:6100
sub_47C3D7_get_fog_specular
int sub_47C3D7_get_fog_specular(int a1, int a2, float a3)
Definition: Outdoor.cpp:3898
pBillboardRenderList
RenderBillboard pBillboardRenderList[500]
Definition: RenderOpenGL.cpp:54
ODMRenderParams::int_fov_rad
int int_fov_rad
Definition: IRender.h:79
IndoorCameraD3D::GetFarClip
float GetFarClip() const
Definition: IndoorCameraD3D.cpp:159
RenderBillboard::screenspace_projection_factor_x
float screenspace_projection_factor_x
Definition: IRender.h:27
RenderBillboardD3D::sParentBillboardID
int sParentBillboardID
Definition: IRender.h:167
pMobileLightsStack
LightsStack_MobileLight_ * pMobileLightsStack
Definition: LightmapBuilder.cpp:14
RenderBase::pD3DSprites
HWLContainer pD3DSprites
Definition: RenderBase.h:33
RenderBillboardD3D::screen_space_z
short screen_space_z
Definition: IRender.h:166
RenderVertexD3D3::specular
unsigned int specular
Definition: IRender.h:133
RenderBillboardD3D::pQuads
RenderVertexD3D3 pQuads[4]
Definition: IRender.h:160
SoftwareBillboard::pTargetZ
int * pTargetZ
Definition: IRender.h:172
pIndoorCameraD3D
IndoorCameraD3D * pIndoorCameraD3D
Definition: IndoorCameraD3D.cpp:21
Viewport::uViewportTL_X
int uViewportTL_X
Definition: Viewport.h:22
left
GLint left
Definition: SDL_opengl_glext.h:1952
stru193_math::uIntegerPi
static const unsigned int uIntegerPi
Definition: OurMath.h:88
LightsStack_MobileLight_::AddLight
bool AddLight(int16_t x, int16_t y, int16_t z, int16_t uSectorID, int uRadius, uint8_t r, uint8_t g, uint8_t b, char a10)
Definition: LightsStack.cpp:6
SoftwareBillboard::sTintColor
int sTintColor
Definition: IRender.h:189
RenderBillboard::world_x
int16_t world_x
Definition: IRender.h:36
config
EGLConfig config
Definition: SDL_egl.h:1149
Sprite::uAreaHeight
int uAreaHeight
Definition: Sprites.h:34
SpriteFrame::uFlags
int uFlags
Definition: Sprites.h:48
RenderBillboard::sTintColor
unsigned int sTintColor
Definition: IRender.h:44
SoftwareBillboard::object_pid
unsigned short object_pid
Definition: IRender.h:190
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52