mirror of
https://github.com/leozide/leocad
synced 2025-01-01 06:19:55 +01:00
Fixed background image not loading.
This commit is contained in:
parent
fcee2cfd7a
commit
e0cfece285
2 changed files with 11 additions and 9 deletions
|
@ -33,7 +33,7 @@ void lcModelProperties::LoadDefaults()
|
||||||
{
|
{
|
||||||
mAuthor = lcGetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME);
|
mAuthor = lcGetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME);
|
||||||
|
|
||||||
mBackgroundType = (lcBackgroundType)lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TILE);
|
mBackgroundType = (lcBackgroundType)lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TYPE);
|
||||||
mBackgroundSolidColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR));
|
mBackgroundSolidColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR));
|
||||||
mBackgroundGradientColor1 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1));
|
mBackgroundGradientColor1 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1));
|
||||||
mBackgroundGradientColor2 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2));
|
mBackgroundGradientColor2 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2));
|
||||||
|
@ -218,7 +218,6 @@ void Project::LoadDefaults(bool cameras)
|
||||||
gMainWindow->UpdateTime(1, 255);
|
gMainWindow->UpdateTime(1, 255);
|
||||||
strcpy(m_strHeader, "");
|
strcpy(m_strHeader, "");
|
||||||
strcpy(m_strFooter, "Page &P");
|
strcpy(m_strFooter, "Page &P");
|
||||||
strcpy(m_strBackground, lcGetProfileString(LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE));
|
|
||||||
m_pTerrain->LoadDefaults(true);
|
m_pTerrain->LoadDefaults(true);
|
||||||
m_OverlayActive = false;
|
m_OverlayActive = false;
|
||||||
|
|
||||||
|
@ -614,7 +613,11 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
|
||||||
file->ReadU16(&sh, 1);
|
file->ReadU16(&sh, 1);
|
||||||
|
|
||||||
if (sh < LC_MAXPATH)
|
if (sh < LC_MAXPATH)
|
||||||
file->ReadBuffer(m_strBackground, sh);
|
{
|
||||||
|
char Background[LC_MAXPATH];
|
||||||
|
file->ReadBuffer(Background, sh);
|
||||||
|
mProperties.mBackgroundImage = Background;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
file->Seek (sh, SEEK_CUR);
|
file->Seek (sh, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
@ -799,9 +802,9 @@ void Project::FileSave(lcFile* file, bool bUndo)
|
||||||
rgb = LC_FLOATRGB(mProperties.mFogColor);
|
rgb = LC_FLOATRGB(mProperties.mFogColor);
|
||||||
file->WriteU32(&rgb, 1);
|
file->WriteU32(&rgb, 1);
|
||||||
file->WriteFloats(&mProperties.mFogDensity, 1);
|
file->WriteFloats(&mProperties.mFogDensity, 1);
|
||||||
sh = strlen(m_strBackground);
|
sh = strlen(mProperties.mBackgroundImage.Buffer());
|
||||||
file->WriteU16(&sh, 1);
|
file->WriteU16(&sh, 1);
|
||||||
file->WriteBuffer(m_strBackground, sh);
|
file->WriteBuffer(mProperties.mBackgroundImage.Buffer(), sh);
|
||||||
ch = strlen(m_strHeader);
|
ch = strlen(m_strHeader);
|
||||||
file->WriteBuffer(&ch, 1);
|
file->WriteBuffer(&ch, 1);
|
||||||
file->WriteBuffer(m_strHeader, ch);
|
file->WriteBuffer(m_strHeader, ch);
|
||||||
|
@ -2844,7 +2847,7 @@ void Project::RenderInitialize()
|
||||||
// m_pTerrain->LoadTexture();
|
// m_pTerrain->LoadTexture();
|
||||||
|
|
||||||
if (mProperties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
if (mProperties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
||||||
if (!m_pBackground->Load(m_strBackground, LC_TEXTURE_WRAPU | LC_TEXTURE_WRAPV))
|
if (!m_pBackground->Load(mProperties.mBackgroundImage.Buffer(), LC_TEXTURE_WRAPU | LC_TEXTURE_WRAPV))
|
||||||
{
|
{
|
||||||
mProperties.mBackgroundType = LC_BACKGROUND_SOLID;
|
mProperties.mBackgroundType = LC_BACKGROUND_SOLID;
|
||||||
// AfxMessageBox ("Could not load background");
|
// AfxMessageBox ("Could not load background");
|
||||||
|
@ -3685,8 +3688,8 @@ void Project::Export3DStudio()
|
||||||
File.WriteFloats(mProperties.mBackgroundSolidColor, 3);
|
File.WriteFloats(mProperties.mBackgroundSolidColor, 3);
|
||||||
|
|
||||||
File.WriteU16(0x1100); // CHK_BIT_MAP
|
File.WriteU16(0x1100); // CHK_BIT_MAP
|
||||||
File.WriteU32(6 + 1 + strlen(m_strBackground));
|
File.WriteU32(6 + 1 + strlen(mProperties.mBackgroundImage.Buffer()));
|
||||||
File.WriteBuffer(m_strBackground, strlen(m_strBackground) + 1);
|
File.WriteBuffer(mProperties.mBackgroundImage.Buffer(), strlen(mProperties.mBackgroundImage.Buffer()) + 1);
|
||||||
|
|
||||||
File.WriteU16(0x1300); // CHK_V_GRADIENT
|
File.WriteU16(0x1300); // CHK_V_GRADIENT
|
||||||
File.WriteU32(118);
|
File.WriteU32(118);
|
||||||
|
|
|
@ -422,7 +422,6 @@ protected:
|
||||||
|
|
||||||
lcModelProperties mProperties;
|
lcModelProperties mProperties;
|
||||||
|
|
||||||
char m_strBackground[LC_MAXPATH];
|
|
||||||
lcTexture* m_pBackground;
|
lcTexture* m_pBackground;
|
||||||
lcTexture* mGridTexture;
|
lcTexture* mGridTexture;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue