Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stretched skyboxes and PVS-Studio bugfixes #172

Merged
merged 2 commits into from
Mar 13, 2017
Merged

Stretched skyboxes and PVS-Studio bugfixes #172

merged 2 commits into from
Mar 13, 2017

Conversation

Xottab-DUTY
Copy link
Member

No description provided.

@Xottab-DUTY Xottab-DUTY changed the title Stretched skyboxes and anomalies fixes Dynamic sun, stretched skyboxes and anomalies Mar 8, 2017
@@ -550,6 +550,9 @@ void CEnvironment::calculate_dynamic_sun_dir()

clamp(cosAZ, -1.0f, 1.0f);
float AZ = acosf(cosAZ);
extern u32 ps_r_sun_direction;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed into a member of CEnvironment called m_sun_direction. Then you can set it by making a command class that sets g_pGamePersistent->Environment().m_sun_direction in Execute().

See https://github.com/OpenXRay/xray-16/blob/dev/src/xrEngine/xr_ioc_cmd.cpp#L463 as an example. Also you could just allow arbitrary sun directions if you make it a float in degrees and convert it to radians when setting m_sun_direction.

@@ -152,7 +152,7 @@ CSpaceRestriction::CBaseRestrictionPtr CSpaceRestriction::merge(
RESTRICTIONS::const_iterator I = temp_restrictions.begin();
RESTRICTIONS::const_iterator E = temp_restrictions.end();
for (; I != E; ++I)
temp = strconcat(sizeof(S), S, *temp, ",", *(*I)->name());
temp = strconcat(strlen(S), S, *temp, ",", *(*I)->name());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strlen is incorrect here, because the string S is empty, so it would always fail. Instead sizeof(S) should be replaced with acc_length, which is the variable used as the size to allocate S.

@@ -685,7 +685,7 @@ BOOL CActor::net_Spawn(CSE_Abstract* DC)
inventory().SetPrevActiveSlot(NO_ACTIVE_SLOT);

//-------------------------------------
m_States.empty();
m_States.clear(); // Xottab_DUTY: check if replace is correct
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this looks correct, but should probably be tested if it doesn't have unintended consequences.

@@ -713,6 +728,7 @@ void CCC_Register()

// Render device states
CMD4(CCC_Integer, "r__supersample", &ps_r__Supersample, 1, 4);
CMD2(CCC_SunDirection, "r__sun_direction", &ps_sun_direction);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be an rs_ command, r__supersample seems to be an outlier here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rs_sun_direction seems more outlined with such commands as rs_stats, rs_fullscreen, rs_gamma and others than r__sun_direction with r__ rendering commands. Maybe the placement isn't good, but name is pretty matches to the other commands

{
CCC_Float::Execute(args);
if (g_pGamePersistent)
g_pGamePersistent->Environment().m_sun_azimuth = ps_sun_direction * (PI / 180.0f);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you test what happens when r__sun_direction 180 is in the user.ltx file? Will the sun direction still be corrected?

Copy link
Member Author

@Xottab-DUTY Xottab-DUTY Mar 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doesn't. By the way... Something went wrong... r__sun_direction 0 and sun born from West, but should born from South. All right with sun, except only it should get params from user.ltx

@@ -97,7 +97,7 @@ size_t xrDebug::BuildStackTrace(char* buffer, size_t capacity, size_t lineCapaci

size_t xrDebug::BuildStackTrace(EXCEPTION_POINTERS* exPtrs, char* buffer, size_t capacity, size_t lineCapacity)
{
memset(buffer, capacity * lineCapacity, 0);
memset(buffer, 0, capacity*lineCapacity);
Copy link
Member Author

@Xottab-DUTY Xottab-DUTY Mar 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be with this fix stack trace will be more appropriate, which is not in some cases(for example, just gives nothing)

@Xottab-DUTY
Copy link
Member Author

@andrew-boyarshin It's not only rendering, but includes other various fixes. (I should pull these in other request, but what's done is done)

@andrew-boyarshin andrew-boyarshin changed the title Dynamic sun, stretched skyboxes and anomalies Dynamic sun, stretched skyboxes and PVS-Studio bugfixes Mar 10, 2017
@andrew-boyarshin
Copy link
Contributor

@Xottab-DUTY I guess the term "anomalies" was used from original PVS-Studio article. It was some kind of reference to gameplay of S.T.A.L.K.E.R., so it was ok. Here it was unexpected and led to misunderstanding.

@CrossVR
Copy link
Contributor

CrossVR commented Mar 10, 2017

@Xottab-DUTY You can still put those in another PR so we can at least merge the PVS fixes now.

Simply use these commands:

git branch render-fixes
git reset --hard c328536
git push -f origin pvs-fixes
git push origin render-fixes

Then you can submit a new PR for your new render-fixes branch.

@CrossVR
Copy link
Contributor

CrossVR commented Mar 10, 2017

Actually you should also remove the PVS commit from the render-fixes branch, but we can fix that in a simple rebase after this PR is merged

@Xottab-DUTY Xottab-DUTY changed the title Dynamic sun, stretched skyboxes and PVS-Studio bugfixes Stretched skyboxes and PVS-Studio bugfixes Mar 11, 2017
@Xottab-DUTY
Copy link
Member Author

Xottab-DUTY commented Mar 11, 2017

Detached sun direction from this PR, it's not ready. You can find it in sundirection of my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants