Remove I3DEngine CryCommon Interface (#567)
Delete: - I3DEngine - Missions - Time of day - GameEffectsSystem Gem - ImageProcessing Gem - SVOGI Gem - Various other things that don't do anything now that the legacy renderer has been removed.main
parent
24df655d8b
commit
d7b796fd73
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : declaration of struct CryEngineDecalInfo.
|
||||
|
||||
// Note:
|
||||
// 3D Engine and Character Animation subsystems (as well as perhaps
|
||||
// some others) transfer data about the decals that need to be spawned
|
||||
// via this structure. This is to avoid passing many parameters through
|
||||
// each function call, and to save on copying these parameters when just
|
||||
// simply passing the structure from one function to another.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_CRYENGINEDECALINFO_H
|
||||
#define CRYINCLUDE_CRYCOMMON_CRYENGINEDECALINFO_H
|
||||
#pragma once
|
||||
|
||||
#include "Cry_Math.h"
|
||||
|
||||
// Summary:
|
||||
// Structure containing common parameters that describe a decal
|
||||
|
||||
struct SDecalOwnerInfo
|
||||
{
|
||||
SDecalOwnerInfo() { memset(this, 0, sizeof(*this)); nRenderNodeSlotId = nRenderNodeSlotSubObjectId = -1; }
|
||||
struct IStatObj* GetOwner(Matrix34A& objMat);
|
||||
|
||||
struct IRenderNode* pRenderNode; // Owner (decal will be attached to or wrapped around of this object)
|
||||
PodArray<struct SRNInfo>* pDecalReceivers;
|
||||
int nRenderNodeSlotId; // is set internally by 3dengine
|
||||
int nRenderNodeSlotSubObjectId; // is set internally by 3dengine
|
||||
int nMatID;
|
||||
};
|
||||
|
||||
struct CryEngineDecalInfo
|
||||
{
|
||||
SDecalOwnerInfo ownerInfo;
|
||||
Vec3 vPos; // Decal position (world coordinates)
|
||||
Vec3 vNormal; // Decal/face normal
|
||||
float fSize; // Decal size
|
||||
float fLifeTime; // Decal life time (in seconds)
|
||||
float fAngle; // Angle of rotation
|
||||
struct IStatObj* pIStatObj; // Decal geometry
|
||||
Vec3 vHitDirection; // Direction from weapon/player position to decal position (bullet direction)
|
||||
float fGrowTime, fGrowTimeAlpha;// Used for blood pools
|
||||
unsigned int nGroupId; // Used for multi-component decals
|
||||
bool bSkipOverlappingTest; // Always spawn decals even if there are a lot of other decals in same place
|
||||
bool bAssemble; // Assemble to bigger decals if more than 1 decal is on the same place
|
||||
bool bForceEdge; // force the decal to the nearest edge of the owner mesh and project it accordingly
|
||||
bool bForceSingleOwner; // Do not attempt to cast the decal into the environment even if it's large enough
|
||||
bool bDeferred;
|
||||
uint8 sortPrio;
|
||||
char szMaterialName[_MAX_PATH]; // name of material used for rendering the decal (in favor of szTextureName/nTid and the default decal shader)
|
||||
bool preventDecalOnGround; // mainly for decal placement support
|
||||
const Matrix33* pExplicitRightUpFront; // mainly for decal placement support
|
||||
|
||||
void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const{}
|
||||
|
||||
// the constructor fills in some non-obligatory fields; the other fields must be filled in by the client
|
||||
CryEngineDecalInfo ()
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
ownerInfo.nRenderNodeSlotId = ownerInfo.nRenderNodeSlotSubObjectId = -1;
|
||||
sortPrio = 255;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_CRYENGINEDECALINFO_H
|
||||
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <platform.h>
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#include AZ_RESTRICTED_FILE(Gem_h)
|
||||
#endif
|
||||
|
||||
#if defined(LINUX) || defined(APPLE) || defined(ANDROID)
|
||||
#define OPENGL 1
|
||||
#endif
|
||||
|
||||
#include <Common/RendererDefs.h>
|
||||
|
||||
#include <Cry_Math.h>
|
||||
#include <Cry_XOptimise.h>
|
||||
#include <Cry_Math.h>
|
||||
#include <Cry_Geo.h>
|
||||
#include <CryArray.h>
|
||||
#include <CryHeaders.h>
|
||||
#include <CrySizer.h>
|
||||
#include <CryArray.h>
|
||||
|
||||
#include <IProcess.h>
|
||||
#include <ITimer.h>
|
||||
#include <ISystem.h>
|
||||
#include <ILog.h>
|
||||
#include <IConsole.h>
|
||||
#include <IRenderer.h>
|
||||
#include <IRenderAuxGeom.h>
|
||||
#include <IEntityRenderState.h>
|
||||
#include <I3DEngine.h>
|
||||
#include <IStreamEngine.h>
|
||||
|
||||
#include <CryArray2d.h>
|
||||
#include <PoolAllocator.h>
|
||||
#include <Cry3DEngineBase.h>
|
||||
#include <cvars.h>
|
||||
#include <Material.h>
|
||||
#include <3dEngine.h>
|
||||
#include <ObjMan.h>
|
||||
#include <StlUtils.h>
|
||||
|
||||
#include <Common/CommonRender.h>
|
||||
#include <Common/Shaders/ShaderComponents.h>
|
||||
#include <Common/Shaders/Shader.h>
|
||||
#include <Common/Shaders/CShader.h>
|
||||
#include <Common/RenderMesh.h>
|
||||
#include <Common/RenderPipeline.h>
|
||||
#include <Common/RenderThread.h>
|
||||
#include <Common/Renderer.h>
|
||||
#include <Common/Textures/Texture.h>
|
||||
#include <Common/Shaders/Parser.h>
|
||||
|
||||
#include <RenderDll/Common/OcclQuery.h>
|
||||
#include <RenderDll/Common/DeferredRenderUtils.h>
|
||||
#include <RenderDll/Common/Textures/TextureManager.h>
|
||||
#include <RenderDll/Common/FrameProfiler.h>
|
||||
#include <RenderDll/XRenderD3D9/DeviceManager/DeviceManagerInline.h>
|
||||
#include <RenderDll/XRenderD3D9/DriverD3D.h>
|
||||
#include <RenderDll/XRenderD3D9/DeviceManager/TempDynBuffer.h>
|
||||
|
||||
#include <AzCore/PlatformDef.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Asset/AssetManagerBus.h>
|
||||
#include <AzCore/Asset/AssetTypeInfoBus.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/IO/GenericStreams.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/Math/Quaternion.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/XML/rapidxml.h>
|
||||
|
||||
#include <AzFramework/Asset/SimpleAsset.h>
|
||||
#include <AzFramework/Asset/AssetCatalogBus.h>
|
||||
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
|
||||
|
||||
#include <LmbrCentral/Rendering/RenderNodeBus.h>
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_I3DENGINE_INFO_H
|
||||
#define CRYINCLUDE_CRYCOMMON_I3DENGINE_INFO_H
|
||||
#pragma once
|
||||
|
||||
#include "TypeInfo_impl.h"
|
||||
#include "IShader_info.h"
|
||||
#include <I3DEngine.h> // <> required for Interfuscator
|
||||
|
||||
STRUCT_INFO_BEGIN(SVisAreaManChunkHeader)
|
||||
STRUCT_VAR_INFO(nVersion, TYPE_INFO(int8))
|
||||
STRUCT_VAR_INFO(nDummy, TYPE_INFO(int8))
|
||||
STRUCT_VAR_INFO(nFlags, TYPE_INFO(int8))
|
||||
STRUCT_VAR_INFO(nFlags2, TYPE_INFO(int8))
|
||||
STRUCT_VAR_INFO(nChunkSize, TYPE_INFO(int))
|
||||
STRUCT_VAR_INFO(nVisAreasNum, TYPE_INFO(int))
|
||||
STRUCT_VAR_INFO(nPortalsNum, TYPE_INFO(int))
|
||||
STRUCT_VAR_INFO(nOcclAreasNum, TYPE_INFO(int))
|
||||
STRUCT_INFO_END(SVisAreaManChunkHeader)
|
||||
|
||||
STRUCT_INFO_BEGIN(SOcTreeNodeChunk)
|
||||
STRUCT_VAR_INFO(nChunkVersion, TYPE_INFO(int16))
|
||||
STRUCT_VAR_INFO(ucChildsMask, TYPE_INFO(int16))
|
||||
STRUCT_VAR_INFO(nodeBox, TYPE_INFO(AABB))
|
||||
STRUCT_VAR_INFO(nObjectsBlockSize, TYPE_INFO(int32))
|
||||
STRUCT_INFO_END(SOcTreeNodeChunk)
|
||||
|
||||
STRUCT_INFO_BEGIN(SHotUpdateInfo)
|
||||
STRUCT_VAR_INFO(nHeigtmap, TYPE_INFO(uint32))
|
||||
STRUCT_VAR_INFO(nObjTypeMask, TYPE_INFO(uint32))
|
||||
STRUCT_VAR_INFO(areaBox, TYPE_INFO(AABB))
|
||||
STRUCT_INFO_END(SHotUpdateInfo)
|
||||
|
||||
STRUCT_INFO_BEGIN(SCommonFileHeader)
|
||||
STRUCT_VAR_INFO(signature, TYPE_ARRAY(4, TYPE_INFO(char)))
|
||||
STRUCT_VAR_INFO(file_type, TYPE_INFO(uint8))
|
||||
STRUCT_VAR_INFO(flags, TYPE_INFO(uint8))
|
||||
STRUCT_VAR_INFO(version, TYPE_INFO(uint16))
|
||||
STRUCT_INFO_END(SCommonFileHeader)
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_I3DENGINE_INFO_H
|
||||
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : Interface for LocalMemoryUsage
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ILOCALMEMORYUSAGE_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ILOCALMEMORYUSAGE_H
|
||||
#pragma once
|
||||
|
||||
|
||||
class CCamera;
|
||||
struct IRenderer;
|
||||
|
||||
struct ILocalMemoryUsage
|
||||
{
|
||||
virtual ~ILocalMemoryUsage(){}
|
||||
virtual void OnRender(IRenderer* pRenderer, const CCamera* camera) = 0;
|
||||
virtual void OnUpdate() = 0;
|
||||
virtual void DeleteGlobalData() = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ILOCALMEMORYUSAGE_H
|
||||
@ -1,286 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
#pragma once
|
||||
|
||||
struct SBezierKey;
|
||||
struct ITimeOfDayUpdateCallback;
|
||||
struct ISplineInterpolator;
|
||||
|
||||
|
||||
//! Interface to the Time Of Day functionality.
|
||||
struct ITimeOfDay
|
||||
{
|
||||
enum ETimeOfDayParamID
|
||||
{
|
||||
PARAM_SUN_COLOR,
|
||||
PARAM_SUN_INTENSITY,
|
||||
PARAM_SUN_SPECULAR_MULTIPLIER,
|
||||
|
||||
PARAM_FOG_COLOR,
|
||||
PARAM_FOG_COLOR_MULTIPLIER,
|
||||
PARAM_VOLFOG_HEIGHT,
|
||||
PARAM_VOLFOG_DENSITY,
|
||||
PARAM_FOG_COLOR2,
|
||||
PARAM_FOG_COLOR2_MULTIPLIER,
|
||||
PARAM_VOLFOG_HEIGHT2,
|
||||
PARAM_VOLFOG_DENSITY2,
|
||||
PARAM_VOLFOG_HEIGHT_OFFSET,
|
||||
|
||||
PARAM_FOG_RADIAL_COLOR,
|
||||
PARAM_FOG_RADIAL_COLOR_MULTIPLIER,
|
||||
PARAM_VOLFOG_RADIAL_SIZE,
|
||||
PARAM_VOLFOG_RADIAL_LOBE,
|
||||
|
||||
PARAM_VOLFOG_FINAL_DENSITY_CLAMP,
|
||||
|
||||
PARAM_VOLFOG_GLOBAL_DENSITY,
|
||||
PARAM_VOLFOG_RAMP_START,
|
||||
PARAM_VOLFOG_RAMP_END,
|
||||
PARAM_VOLFOG_RAMP_INFLUENCE,
|
||||
|
||||
PARAM_VOLFOG_SHADOW_DARKENING,
|
||||
PARAM_VOLFOG_SHADOW_DARKENING_SUN,
|
||||
PARAM_VOLFOG_SHADOW_DARKENING_AMBIENT,
|
||||
PARAM_VOLFOG_SHADOW_RANGE,
|
||||
|
||||
PARAM_VOLFOG2_HEIGHT,
|
||||
PARAM_VOLFOG2_DENSITY,
|
||||
PARAM_VOLFOG2_HEIGHT2,
|
||||
PARAM_VOLFOG2_DENSITY2,
|
||||
PARAM_VOLFOG2_GLOBAL_DENSITY,
|
||||
PARAM_VOLFOG2_RAMP_START,
|
||||
PARAM_VOLFOG2_RAMP_END,
|
||||
PARAM_VOLFOG2_COLOR1,
|
||||
PARAM_VOLFOG2_ANISOTROPIC1,
|
||||
PARAM_VOLFOG2_COLOR2,
|
||||
PARAM_VOLFOG2_ANISOTROPIC2,
|
||||
PARAM_VOLFOG2_BLEND_FACTOR,
|
||||
PARAM_VOLFOG2_BLEND_MODE,
|
||||
PARAM_VOLFOG2_COLOR,
|
||||
PARAM_VOLFOG2_ANISOTROPIC,
|
||||
PARAM_VOLFOG2_RANGE,
|
||||
PARAM_VOLFOG2_INSCATTER,
|
||||
PARAM_VOLFOG2_EXTINCTION,
|
||||
PARAM_VOLFOG2_GLOBAL_FOG_VISIBILITY,
|
||||
PARAM_VOLFOG2_FINAL_DENSITY_CLAMP,
|
||||
|
||||
PARAM_SKYLIGHT_SUN_INTENSITY,
|
||||
PARAM_SKYLIGHT_SUN_INTENSITY_MULTIPLIER,
|
||||
|
||||
PARAM_SKYLIGHT_KM,
|
||||
PARAM_SKYLIGHT_KR,
|
||||
PARAM_SKYLIGHT_G,
|
||||
|
||||
PARAM_SKYLIGHT_WAVELENGTH_R,
|
||||
PARAM_SKYLIGHT_WAVELENGTH_G,
|
||||
PARAM_SKYLIGHT_WAVELENGTH_B,
|
||||
|
||||
PARAM_NIGHSKY_HORIZON_COLOR,
|
||||
PARAM_NIGHSKY_HORIZON_COLOR_MULTIPLIER,
|
||||
PARAM_NIGHSKY_ZENITH_COLOR,
|
||||
PARAM_NIGHSKY_ZENITH_COLOR_MULTIPLIER,
|
||||
PARAM_NIGHSKY_ZENITH_SHIFT,
|
||||
|
||||
PARAM_NIGHSKY_START_INTENSITY,
|
||||
|
||||
PARAM_NIGHSKY_MOON_COLOR,
|
||||
PARAM_NIGHSKY_MOON_COLOR_MULTIPLIER,
|
||||
PARAM_NIGHSKY_MOON_INNERCORONA_COLOR,
|
||||
PARAM_NIGHSKY_MOON_INNERCORONA_COLOR_MULTIPLIER,
|
||||
PARAM_NIGHSKY_MOON_INNERCORONA_SCALE,
|
||||
PARAM_NIGHSKY_MOON_OUTERCORONA_COLOR,
|
||||
PARAM_NIGHSKY_MOON_OUTERCORONA_COLOR_MULTIPLIER,
|
||||
PARAM_NIGHSKY_MOON_OUTERCORONA_SCALE,
|
||||
|
||||
PARAM_CLOUDSHADING_SUNLIGHT_MULTIPLIER,
|
||||
PARAM_CLOUDSHADING_SUNLIGHT_CUSTOM_COLOR,
|
||||
PARAM_CLOUDSHADING_SUNLIGHT_CUSTOM_COLOR_MULTIPLIER,
|
||||
PARAM_CLOUDSHADING_SUNLIGHT_CUSTOM_COLOR_INFLUENCE,
|
||||
|
||||
PARAM_SUN_SHAFTS_VISIBILITY,
|
||||
PARAM_SUN_RAYS_VISIBILITY,
|
||||
PARAM_SUN_RAYS_ATTENUATION,
|
||||
PARAM_SUN_RAYS_SUNCOLORINFLUENCE,
|
||||
PARAM_SUN_RAYS_CUSTOMCOLOR,
|
||||
|
||||
PARAM_OCEANFOG_COLOR, // Remove when ocean related feature toggle is removed.
|
||||
PARAM_OCEANFOG_COLOR_MULTIPLIER, // Remove when ocean related feature toggle is removed.
|
||||
PARAM_OCEANFOG_DENSITY, // Remove when ocean related feature toggle is removed.
|
||||
|
||||
PARAM_SKYBOX_MULTIPLIER,
|
||||
|
||||
PARAM_HDR_FILMCURVE_SHOULDER_SCALE,
|
||||
PARAM_HDR_FILMCURVE_LINEAR_SCALE,
|
||||
PARAM_HDR_FILMCURVE_TOE_SCALE,
|
||||
PARAM_HDR_FILMCURVE_WHITEPOINT,
|
||||
|
||||
PARAM_HDR_COLORGRADING_COLOR_SATURATION,
|
||||
PARAM_HDR_COLORGRADING_COLOR_BALANCE,
|
||||
|
||||
PARAM_HDR_EYEADAPTATION_SCENEKEY,
|
||||
PARAM_HDR_EYEADAPTATION_MIN_EXPOSURE,
|
||||
PARAM_HDR_EYEADAPTATION_MAX_EXPOSURE,
|
||||
PARAM_HDR_EYEADAPTATION_EV_MIN,
|
||||
PARAM_HDR_EYEADAPTATION_EV_MAX,
|
||||
PARAM_HDR_EYEADAPTATION_EV_AUTO_COMPENSATION,
|
||||
PARAM_HDR_BLOOM_AMOUNT,
|
||||
|
||||
PARAM_COLORGRADING_FILTERS_GRAIN,
|
||||
PARAM_COLORGRADING_FILTERS_PHOTOFILTER_COLOR,
|
||||
PARAM_COLORGRADING_FILTERS_PHOTOFILTER_DENSITY,
|
||||
|
||||
PARAM_COLORGRADING_DOF_FOCUSRANGE,
|
||||
PARAM_COLORGRADING_DOF_BLURAMOUNT,
|
||||
|
||||
PARAM_SHADOWSC0_BIAS,
|
||||
PARAM_SHADOWSC0_SLOPE_BIAS,
|
||||
PARAM_SHADOWSC1_BIAS,
|
||||
PARAM_SHADOWSC1_SLOPE_BIAS,
|
||||
PARAM_SHADOWSC2_BIAS,
|
||||
PARAM_SHADOWSC2_SLOPE_BIAS,
|
||||
PARAM_SHADOWSC3_BIAS,
|
||||
PARAM_SHADOWSC3_SLOPE_BIAS,
|
||||
PARAM_SHADOWSC4_BIAS,
|
||||
PARAM_SHADOWSC4_SLOPE_BIAS,
|
||||
PARAM_SHADOWSC5_BIAS,
|
||||
PARAM_SHADOWSC5_SLOPE_BIAS,
|
||||
PARAM_SHADOWSC6_BIAS,
|
||||
PARAM_SHADOWSC6_SLOPE_BIAS,
|
||||
PARAM_SHADOWSC7_BIAS,
|
||||
PARAM_SHADOWSC7_SLOPE_BIAS,
|
||||
|
||||
PARAM_SHADOW_JITTERING,
|
||||
|
||||
PARAM_HDR_DYNAMIC_POWER_FACTOR,
|
||||
PARAM_TERRAIN_OCCL_MULTIPLIER,
|
||||
PARAM_SUN_COLOR_MULTIPLIER,
|
||||
|
||||
PARAM_TOTAL
|
||||
};
|
||||
|
||||
struct SPresetInfo
|
||||
{
|
||||
const char* m_pName;
|
||||
bool m_bCurrent;
|
||||
};
|
||||
|
||||
enum EVariableType
|
||||
{
|
||||
TYPE_FLOAT,
|
||||
TYPE_COLOR
|
||||
};
|
||||
struct SVariableInfo
|
||||
{
|
||||
const char* name; //!< Variable name.
|
||||
const char* displayName; //!< Variable user readable name.
|
||||
const char* group; //!< Group name.
|
||||
int nParamId;
|
||||
EVariableType type;
|
||||
float fValue[3]; //!< Value of the variable (3 needed for color type).
|
||||
ISplineInterpolator* pInterpolator; //!< Splines that control variable value.
|
||||
};
|
||||
struct SAdvancedInfo
|
||||
{
|
||||
float fStartTime;
|
||||
float fEndTime;
|
||||
float fAnimSpeed;
|
||||
};
|
||||
struct SEnvironmentInfo
|
||||
{
|
||||
SEnvironmentInfo()
|
||||
: bSunLinkedToTOD(true)
|
||||
, sunRotationLatitude(0)
|
||||
, sunRotationLongitude(0){}
|
||||
bool bSunLinkedToTOD;
|
||||
float sunRotationLatitude;
|
||||
float sunRotationLongitude;
|
||||
};
|
||||
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ITimeOfDay(){}
|
||||
|
||||
virtual int GetPresetCount() const = 0;
|
||||
virtual bool GetPresetsInfos(SPresetInfo* resultArray, unsigned int arraySize) const = 0;
|
||||
virtual bool SetCurrentPreset(const char* szPresetName) = 0;
|
||||
virtual bool AddNewPreset(const char* szPresetName) = 0;
|
||||
virtual bool RemovePreset(const char* szPresetName) = 0;
|
||||
virtual bool SavePreset(const char* szPresetName) const = 0;
|
||||
virtual bool LoadPreset(const char* szFilePath) = 0;
|
||||
virtual void ResetPreset(const char* szPresetName) = 0;
|
||||
|
||||
virtual bool ImportPreset(const char* szPresetName, const char* szFilePath) = 0;
|
||||
virtual bool ExportPreset(const char* szPresetName, const char* szFilePath) const = 0;
|
||||
|
||||
//! Access to variables that control time of the day appearance.
|
||||
virtual int GetVariableCount() const = 0;
|
||||
virtual bool GetVariableInfo(int nIndex, SVariableInfo& varInfo) const = 0;
|
||||
virtual void SetVariableValue(int nIndex, float fValue[3]) = 0;
|
||||
|
||||
//! Editor interface.
|
||||
virtual bool InterpolateVarInRange(int nIndex, float fMin, float fMax, unsigned int nCount, Vec3* resultArray) const = 0;
|
||||
virtual uint GetSplineKeysCount(int nIndex, int nSpline) const = 0;
|
||||
virtual bool GetSplineKeysForVar(int nIndex, int nSpline, SBezierKey* keysArray, unsigned int keysArraySize) const = 0;
|
||||
virtual bool SetSplineKeysForVar(int nIndex, int nSpline, const SBezierKey* keysArray, unsigned int keysArraySize) = 0;
|
||||
virtual bool UpdateSplineKeyForVar(int nIndex, int nSpline, float fTime, float newValue) = 0;
|
||||
|
||||
virtual void ResetVariables() = 0;
|
||||
|
||||
//! Sets the time of the day specified in hours.
|
||||
virtual void SetTime(float fHour, bool bForceUpdate = false, bool bForceEnvUpdate = true) = 0;
|
||||
virtual float GetTime() = 0;
|
||||
|
||||
//! Sun position.
|
||||
virtual void SetSunPos(float longitude, float latitude) = 0;
|
||||
virtual float GetSunLatitude() = 0;
|
||||
virtual float GetSunLongitude() = 0;
|
||||
|
||||
//! Updates the current ToD.
|
||||
virtual void Tick() = 0;
|
||||
|
||||
|
||||
virtual void SetPaused(bool paused) = 0;
|
||||
|
||||
virtual void SetAdvancedInfo(const SAdvancedInfo& advInfo) = 0;
|
||||
virtual void GetAdvancedInfo(SAdvancedInfo& advInfo) = 0;
|
||||
|
||||
//! Updates engine parameters after variable values have been changed.
|
||||
virtual void Update(bool bInterpolate = true, bool bForceUpdate = false, bool bForceEnvUpdate = true) = 0;
|
||||
virtual void SetUpdateCallback(ITimeOfDayUpdateCallback* pCallback) = 0;
|
||||
|
||||
virtual void BeginEditMode() = 0;
|
||||
virtual void EndEditMode() = 0;
|
||||
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
|
||||
virtual void Serialize(TSerialize ser) = 0;
|
||||
|
||||
virtual void SetTimer(ITimer* pTimer) = 0;
|
||||
virtual void SetEnvironmentSettings(const SEnvironmentInfo& envInfo) = 0;
|
||||
virtual void LerpWith(const ITimeOfDay& other, float lerpValue, ITimeOfDay& output) const = 0;
|
||||
|
||||
//! Multiplayer serialization.
|
||||
static const int NETSER_FORCESET = BIT(0);
|
||||
static const int NETSER_COMPENSATELAG = BIT(1);
|
||||
static const int NETSER_STATICPROPS = BIT(2);
|
||||
virtual void NetSerialize(TSerialize ser, float lag, uint32 flags) = 0;
|
||||
};
|
||||
|
||||
struct ITimeOfDayUpdateCallback
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ITimeOfDayUpdateCallback(){}
|
||||
virtual void BeginUpdate() = 0;
|
||||
virtual bool GetCustomValue(ITimeOfDay::ETimeOfDayParamID paramID, int dim, float* pValues, float& blendWeight) = 0;
|
||||
virtual void EndUpdate() = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
@ -1,528 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
|
||||
#include <I3DEngine.h>
|
||||
#include <ISerialize.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
// the following was generated using google's python script to autogenerate mocks.
|
||||
// however, it needed some hand-editing to make it work, so if you add functions to I3DEngine,
|
||||
// it will probably be better to just manually add them here than try to run the script again.
|
||||
|
||||
class I3DEngineMock
|
||||
: public I3DEngine
|
||||
{
|
||||
public:
|
||||
// From IProcess
|
||||
MOCK_METHOD1(SetFlags,
|
||||
void(int));
|
||||
MOCK_METHOD0(GetFlags,
|
||||
int(void));
|
||||
|
||||
// From I3DEngine
|
||||
MOCK_METHOD0(Init,
|
||||
bool());
|
||||
MOCK_METHOD1(SetLevelPath,
|
||||
void(const char* szFolderName));
|
||||
MOCK_METHOD1(CheckMinSpec,
|
||||
bool(uint32 nMinSpec));
|
||||
MOCK_METHOD1(PrepareOcclusion,
|
||||
void(const CCamera& rCamera));
|
||||
MOCK_METHOD0(EndOcclusion,
|
||||
void());
|
||||
MOCK_METHOD2(LoadLevel,
|
||||
bool(const char* szFolderName, const char* szMissionName));
|
||||
MOCK_METHOD2(InitLevelForEditor,
|
||||
bool(const char* szFolderName, const char* szMissionName));
|
||||
MOCK_METHOD0(LevelLoadingInProgress,
|
||||
bool());
|
||||
MOCK_METHOD0(OnFrameStart,
|
||||
void());
|
||||
MOCK_METHOD0(PostLoadLevel,
|
||||
void());
|
||||
MOCK_METHOD0(LoadEmptyLevel,
|
||||
void());
|
||||
MOCK_METHOD0(UnloadLevel,
|
||||
void());
|
||||
MOCK_METHOD0(Update,
|
||||
void());
|
||||
MOCK_CONST_METHOD0(GetRenderingCamera,
|
||||
const CCamera&());
|
||||
MOCK_CONST_METHOD0(GetZoomFactor,
|
||||
float());
|
||||
MOCK_METHOD0(Tick,
|
||||
void());
|
||||
MOCK_METHOD0(UpdateShaderItems,
|
||||
void());
|
||||
MOCK_METHOD0(Release,
|
||||
void());
|
||||
MOCK_METHOD3(RenderWorld,
|
||||
void(int nRenderFlags, const SRenderingPassInfo& passInfo, const char* szDebugName));
|
||||
MOCK_METHOD2(RenderSceneReflection,
|
||||
void(int nRenderFlags, const SRenderingPassInfo& passInfo));
|
||||
MOCK_METHOD1(PreWorldStreamUpdate,
|
||||
void(const CCamera& cam));
|
||||
MOCK_METHOD0(WorldStreamUpdate,
|
||||
void());
|
||||
MOCK_METHOD0(ShutDown,
|
||||
void());
|
||||
MOCK_METHOD7(LoadStatObjUnsafeManualRef,
|
||||
IStatObj*(const char* fileName, const char* geomName, IStatObj::SSubObject** subObject,
|
||||
bool useStreaming, unsigned long loadingFlags, const void* data, int dataSize));
|
||||
MOCK_METHOD7(LoadStatObjAutoRef,
|
||||
_smart_ptr<IStatObj>(const char* fileName, const char* geomName, IStatObj::SSubObject** subObject,
|
||||
bool useStreaming, unsigned long loadingFlags, const void* data, int dataSize));
|
||||
MOCK_METHOD0(ProcessAsyncStaticObjectLoadRequests,
|
||||
void());
|
||||
MOCK_METHOD5(LoadStatObjAsync,
|
||||
void(LoadStaticObjectAsyncResult resultCallback, const char* szFileName, const char* szGeomName, bool bUseStreaming, unsigned long nLoadingFlags));
|
||||
MOCK_METHOD1(FindStatObjectByFilename,
|
||||
IStatObj*(const char* filename));
|
||||
MOCK_METHOD0(GetGSMRange,
|
||||
const float());
|
||||
MOCK_METHOD0(GetGSMRangeStep,
|
||||
const float());
|
||||
MOCK_METHOD0(GetLoadedObjectCount,
|
||||
int());
|
||||
MOCK_METHOD2(GetLoadedStatObjArray,
|
||||
void(IStatObj** pObjectsArray, int& nCount));
|
||||
MOCK_METHOD1(GetObjectsStreamingStatus,
|
||||
void(SObjectsStreamingStatus& outStatus));
|
||||
MOCK_METHOD2(GetStreamingSubsystemData,
|
||||
void(int subsystem, SStremaingBandwidthData& outData));
|
||||
MOCK_METHOD3(RegisterEntity,
|
||||
void(IRenderNode* pEntity, int nSID, int nSIDConsideredSafe));
|
||||
MOCK_METHOD1(SelectEntity,
|
||||
void(IRenderNode* pEntity));
|
||||
MOCK_METHOD0(IsSunShadows,
|
||||
bool());
|
||||
MOCK_METHOD2(MakeSystemMaterialFromShaderHelper
|
||||
, _smart_ptr<IMaterial>(const char* sShaderName, SInputShaderResources* Res));
|
||||
MOCK_METHOD1(CheckMinSpecHelper
|
||||
, bool(uint32 nMinSpec));
|
||||
MOCK_METHOD1(OnCasterDeleted
|
||||
, void(IShadowCaster* pCaster));
|
||||
MOCK_METHOD4(GetStatObjAndMatTables,
|
||||
void(DynArray<IStatObj*>* pStatObjTable, DynArray<_smart_ptr<IMaterial>>* pMatTable, DynArray<IStatInstGroup*>* pStatInstGroupTable, uint32 nObjTypeMask));
|
||||
#ifndef _RELEASE
|
||||
MOCK_METHOD1(AddObjToDebugDrawList,
|
||||
void(SObjectInfoToAddToDebugDrawList& objInfo));
|
||||
MOCK_CONST_METHOD0(IsDebugDrawListEnabled,
|
||||
bool());
|
||||
#endif
|
||||
MOCK_METHOD1(UnRegisterEntityDirect,
|
||||
void(IRenderNode* pEntity));
|
||||
MOCK_METHOD1(UnRegisterEntityAsJob,
|
||||
void(IRenderNode* pEnt));
|
||||
MOCK_CONST_METHOD1(IsUnderWater,
|
||||
bool(const Vec3& vPos));
|
||||
MOCK_METHOD1(SetOceanRenderFlags,
|
||||
void(uint8 nFlags));
|
||||
MOCK_CONST_METHOD0(GetOceanRenderFlags,
|
||||
uint8());
|
||||
MOCK_CONST_METHOD0(GetOceanVisiblePixelsCount,
|
||||
uint32());
|
||||
MOCK_METHOD3(GetBottomLevel,
|
||||
float(const Vec3& referencePos, float maxRelevantDepth, int objtypes));
|
||||
MOCK_METHOD2(GetBottomLevel,
|
||||
float(const Vec3& referencePos, float maxRelevantDepth));
|
||||
MOCK_METHOD2(GetBottomLevel,
|
||||
float(const Vec3& referencePos, int objflags));
|
||||
MOCK_METHOD0(GetWaterLevel,
|
||||
float());
|
||||
MOCK_METHOD3(GetWaterLevel,
|
||||
float(const Vec3* pvPos, IPhysicalEntity* pent, bool bAccurate));
|
||||
MOCK_CONST_METHOD1(GetAccurateOceanHeight,
|
||||
float(const Vec3& pCurrPos));
|
||||
MOCK_CONST_METHOD0(GetCausticsParams,
|
||||
CausticsParams());
|
||||
MOCK_CONST_METHOD0(GetOceanAnimationParams,
|
||||
OceanAnimationData());
|
||||
MOCK_CONST_METHOD1(GetHDRSetupParams,
|
||||
void(Vec4 pParams[5]));
|
||||
MOCK_METHOD0(ResetParticlesAndDecals,
|
||||
void());
|
||||
MOCK_METHOD1(CreateDecal,
|
||||
void(const CryEngineDecalInfo& Decal));
|
||||
MOCK_METHOD2(DeleteDecalsInRange,
|
||||
void(AABB* pAreaBox, IRenderNode* pEntity));
|
||||
MOCK_METHOD1(SetSunColor,
|
||||
void(Vec3 vColor));
|
||||
MOCK_METHOD0(GetSunAnimColor,
|
||||
Vec3());
|
||||
MOCK_METHOD1(SetSunAnimColor,
|
||||
void(const Vec3& color));
|
||||
MOCK_METHOD0(GetSunAnimSpeed,
|
||||
float());
|
||||
MOCK_METHOD1(SetSunAnimSpeed,
|
||||
void(float sunAnimSpeed));
|
||||
MOCK_METHOD0(GetSunAnimPhase,
|
||||
AZ::u8());
|
||||
MOCK_METHOD1(SetSunAnimPhase,
|
||||
void(AZ::u8 sunAnimPhase));
|
||||
MOCK_METHOD0(GetSunAnimIndex,
|
||||
AZ::u8());
|
||||
MOCK_METHOD1(SetSunAnimIndex,
|
||||
void(AZ::u8 sunAnimIndex));
|
||||
MOCK_METHOD1(SetRainParams,
|
||||
void(const SRainParams& rainParams));
|
||||
MOCK_METHOD1(GetRainParams,
|
||||
bool(SRainParams& rainParams));
|
||||
MOCK_METHOD5(SetSnowSurfaceParams,
|
||||
void(const Vec3& vCenter, float fRadius, float fSnowAmount, float fFrostAmount, float fSurfaceFreezing));
|
||||
MOCK_METHOD5(GetSnowSurfaceParams,
|
||||
bool(Vec3& vCenter, float& fRadius, float& fSnowAmount, float& fFrostAmount, float& fSurfaceFreezing));
|
||||
MOCK_METHOD7(SetSnowFallParams,
|
||||
void(int nSnowFlakeCount, float fSnowFlakeSize, float fSnowFallBrightness, float fSnowFallGravityScale, float fSnowFallWindScale, float fSnowFallTurbulence, float fSnowFallTurbulenceFreq));
|
||||
MOCK_METHOD7(GetSnowFallParams,
|
||||
bool(int& nSnowFlakeCount, float& fSnowFlakeSize, float& fSnowFallBrightness, float& fSnowFallGravityScale, float& fSnowFallWindScale, float& fSnowFallTurbulence, float& fSnowFallTurbulenceFreq));
|
||||
MOCK_METHOD1(SetMaxViewDistanceScale,
|
||||
void(float fScale));
|
||||
MOCK_METHOD1(GetMaxViewDistance,
|
||||
float(bool));
|
||||
MOCK_CONST_METHOD0(GetFrameLodInfo,
|
||||
const SFrameLodInfo&());
|
||||
MOCK_METHOD1(SetFrameLodInfo,
|
||||
void(const SFrameLodInfo& frameLodInfo));
|
||||
MOCK_METHOD1(SetFogColor,
|
||||
void(const Vec3& vFogColor));
|
||||
MOCK_METHOD0(GetFogColor,
|
||||
Vec3());
|
||||
MOCK_METHOD6(GetSkyLightParameters,
|
||||
void(Vec3& sunDir, Vec3& sunIntensity, float& Km, float& Kr, float& g, Vec3& rgbWaveLengths));
|
||||
MOCK_METHOD7(SetSkyLightParameters,
|
||||
void(const Vec3& sunDir, const Vec3& sunIntensity, float Km, float Kr, float g, const Vec3& rgbWaveLengths, bool forceImmediateUpdate));
|
||||
MOCK_CONST_METHOD0(GetLightsHDRDynamicPowerFactor,
|
||||
float());
|
||||
MOCK_CONST_METHOD3(IsTessellationAllowed,
|
||||
bool(const CRenderObject* pObj, const SRenderingPassInfo& passInfo, bool bIgnoreShadowPass));
|
||||
MOCK_METHOD3(SetRenderNodeMaterialAtPosition,
|
||||
void(EERType eNodeType, const Vec3& vPos, _smart_ptr<IMaterial> pMat));
|
||||
MOCK_METHOD1(OverrideCameraPrecachePoint,
|
||||
void(const Vec3& vPos));
|
||||
MOCK_METHOD4(AddPrecachePoint,
|
||||
int(const Vec3& vPos, const Vec3& vDir, float fTimeOut, float fImportanceFactor));
|
||||
MOCK_METHOD1(ClearPrecachePoint,
|
||||
void(int id));
|
||||
MOCK_METHOD0(ClearAllPrecachePoints,
|
||||
void());
|
||||
MOCK_METHOD1(GetPrecacheRoundIds,
|
||||
void(int pRoundIds[MAX_STREAM_PREDICTION_ZONES]));
|
||||
MOCK_METHOD5(TraceFogVolumes,
|
||||
void(const Vec3& vPos, const AABB& objBBox, SFogVolumeData& fogVolData, const SRenderingPassInfo& passInfo, bool fogVolumeShadingQuality));
|
||||
|
||||
MOCK_METHOD1(RemoveAllStaticObjects,
|
||||
void(int));
|
||||
MOCK_METHOD3(SetStatInstGroup,
|
||||
bool(int nGroupId, const IStatInstGroup& siGroup, int nSID));
|
||||
MOCK_METHOD3(GetStatInstGroup,
|
||||
bool(int, IStatInstGroup&, int));
|
||||
MOCK_METHOD3(OnExplosion,
|
||||
void(Vec3, float, bool));
|
||||
MOCK_METHOD1(SetPhysMaterialEnumerator,
|
||||
void(IPhysMaterialEnumerator* pPhysMaterialEnumerator));
|
||||
MOCK_METHOD0(GetPhysMaterialEnumerator,
|
||||
IPhysMaterialEnumerator*());
|
||||
MOCK_METHOD0(SetupDistanceFog,
|
||||
void());
|
||||
MOCK_METHOD1(LoadMissionDataFromXMLNode,
|
||||
void(const char* szMissionName));
|
||||
MOCK_METHOD2(LoadEnvironmentSettingsFromXML,
|
||||
void(XmlNodeRef, int));
|
||||
MOCK_METHOD0(LoadCompiledOctreeForEditor,
|
||||
bool());
|
||||
MOCK_CONST_METHOD0(GetSunDir,
|
||||
Vec3());
|
||||
MOCK_CONST_METHOD0(GetSunDirNormalized,
|
||||
Vec3());
|
||||
MOCK_CONST_METHOD0(GetRealtimeSunDirNormalized,
|
||||
Vec3());
|
||||
MOCK_METHOD0(GetDistanceToSectorWithWater,
|
||||
float());
|
||||
MOCK_CONST_METHOD0(GetSunColor,
|
||||
Vec3());
|
||||
MOCK_CONST_METHOD0(GetSSAOAmount,
|
||||
float());
|
||||
MOCK_CONST_METHOD0(GetSSAOContrast,
|
||||
float());
|
||||
MOCK_METHOD1(FreeRenderNodeState,
|
||||
void(IRenderNode* pEntity));
|
||||
MOCK_METHOD1(GetLevelFilePath,
|
||||
const char*(const char* szFileName));
|
||||
MOCK_METHOD4(DisplayInfo,
|
||||
void(float& fTextPosX, float& fTextPosY, float& fTextStepY, bool bEnhanced));
|
||||
MOCK_METHOD0(DisplayMemoryStatistics,
|
||||
void());
|
||||
|
||||
// Can't mock methods with variable parameters so just create empty bodies for them.
|
||||
void DrawTextRightAligned([[maybe_unused]] const float x, [[maybe_unused]] const float y, [[maybe_unused]] const char* format, ...) override {}
|
||||
void DrawTextRightAligned([[maybe_unused]] const float x, [[maybe_unused]] const float y, [[maybe_unused]] const float scale, [[maybe_unused]] const ColorF& color, [[maybe_unused]] const char* format, ...) override {}
|
||||
|
||||
MOCK_METHOD3(DrawBBoxHelper
|
||||
, void (const Vec3& vMin, const Vec3& vMax, ColorB col));
|
||||
MOCK_METHOD2(DrawBBoxHelper
|
||||
, void (const AABB& box, ColorB col));
|
||||
|
||||
MOCK_METHOD3(ActivatePortal,
|
||||
void(const Vec3& vPos, bool bActivate, const char* szEntityName));
|
||||
MOCK_CONST_METHOD1(GetMemoryUsage,
|
||||
void(ICrySizer* pSizer));
|
||||
MOCK_METHOD2(GetResourceMemoryUsage,
|
||||
void(ICrySizer* pSizer, const AABB& cstAABB));
|
||||
MOCK_METHOD1(CreateVisArea,
|
||||
IVisArea*(uint64 visGUID));
|
||||
MOCK_METHOD1(DeleteVisArea,
|
||||
void(IVisArea* pVisArea));
|
||||
MOCK_METHOD6(UpdateVisArea,
|
||||
void(IVisArea* pArea, const Vec3* pPoints, int nCount, const char* szName, const SVisAreaInfo& info, bool bReregisterObjects));
|
||||
MOCK_METHOD4(IsVisAreasConnected,
|
||||
bool(IVisArea* pArea1, IVisArea* pArea2, int nMaxRecursion, bool bSkipDisabledPortals));
|
||||
MOCK_METHOD0(CreateClipVolume,
|
||||
IClipVolume*());
|
||||
MOCK_METHOD1(DeleteClipVolume,
|
||||
void(IClipVolume* pClipVolume));
|
||||
MOCK_METHOD7(UpdateClipVolume,
|
||||
void(IClipVolume* pClipVolume, _smart_ptr<IRenderMesh> pRenderMesh, IBSPTree3D* pBspTree, const Matrix34& worldTM, bool bActive, uint32 flags, const char* szName));
|
||||
MOCK_METHOD1(CreateRenderNode,
|
||||
IRenderNode*(EERType type));
|
||||
MOCK_METHOD1(DeleteRenderNode,
|
||||
void(IRenderNode* pRenderNode));
|
||||
MOCK_METHOD1(SetWind,
|
||||
void(const Vec3& vWind));
|
||||
MOCK_CONST_METHOD2(GetWind,
|
||||
Vec3(const AABB& box, bool bIndoors));
|
||||
MOCK_CONST_METHOD1(GetGlobalWind,
|
||||
Vec3(bool bIndoors));
|
||||
MOCK_CONST_METHOD4(SampleWind,
|
||||
bool(Vec3* pSamples, int nSamples, const AABB& volume, bool bIndoors));
|
||||
MOCK_METHOD1(GetVisAreaFromPos,
|
||||
IVisArea*(const Vec3& vPos));
|
||||
MOCK_METHOD2(IntersectsVisAreas,
|
||||
bool(const AABB& box, void** pNodeCache));
|
||||
MOCK_METHOD4(ClipToVisAreas,
|
||||
bool(IVisArea* pInside, Sphere& sphere, Vec3 const& vNormal, void* pNodeCache));
|
||||
MOCK_METHOD1(EnableOceanRendering,
|
||||
void(bool bOcean));
|
||||
MOCK_METHOD1(AddTextureLoadHandler,
|
||||
void(ITextureLoadHandler* pHandler));
|
||||
MOCK_METHOD1(RemoveTextureLoadHandler,
|
||||
void(ITextureLoadHandler* pHandler));
|
||||
MOCK_METHOD1(GetTextureLoadHandlerForImage,
|
||||
ITextureLoadHandler*(const char* ext));
|
||||
MOCK_METHOD0(CreateLightSource,
|
||||
struct ILightSource*());
|
||||
MOCK_METHOD1(DeleteLightSource,
|
||||
void(ILightSource* pLightSource));
|
||||
MOCK_METHOD0(GetLightEntities,
|
||||
const PodArray<ILightSource*>* ());
|
||||
MOCK_METHOD3(GetLightVolumes,
|
||||
void(threadID nThreadID, SLightVolume*& pLightVols, uint32& nNumVols));
|
||||
MOCK_METHOD4(RegisterVolumeForLighting,
|
||||
uint16(const Vec3& vPos, f32 fRadius, uint8 nClipVolumeRef, const SRenderingPassInfo& passInfo));
|
||||
MOCK_METHOD1(RestoreTerrainFromDisk,
|
||||
bool(int));
|
||||
MOCK_METHOD1(GetFilePath,
|
||||
const char*(const char* szFileName));
|
||||
MOCK_CONST_METHOD0(GetPostEffectGroups,
|
||||
class IPostEffectGroupManager*());
|
||||
MOCK_CONST_METHOD0(GetPostEffectBaseGroup,
|
||||
class IPostEffectGroup*());
|
||||
MOCK_CONST_METHOD3(SetPostEffectParam,
|
||||
void(const char* pParam, float fValue, bool bForceValue));
|
||||
MOCK_CONST_METHOD3(SetPostEffectParamVec4,
|
||||
void(const char* pParam, const Vec4& pValue, bool bForceValue));
|
||||
MOCK_CONST_METHOD2(SetPostEffectParamString,
|
||||
void(const char* pParam, const char* pszArg));
|
||||
MOCK_CONST_METHOD2(GetPostEffectParam,
|
||||
void(const char* pParam, float& fValue));
|
||||
MOCK_CONST_METHOD2(GetPostEffectParamVec4,
|
||||
void(const char* pParam, Vec4& pValue));
|
||||
MOCK_CONST_METHOD2(GetPostEffectParamString,
|
||||
void(const char* pParam, const char*& pszArg));
|
||||
MOCK_METHOD1(GetPostEffectID,
|
||||
int32(const char* pPostEffectName));
|
||||
MOCK_METHOD1(ResetPostEffects,
|
||||
void(bool));
|
||||
MOCK_METHOD0(DisablePostEffects,
|
||||
void());
|
||||
MOCK_METHOD1(SetShadowsGSMCache,
|
||||
void(bool bCache));
|
||||
MOCK_METHOD2(SetCachedShadowBounds,
|
||||
void(const AABB& shadowBounds, float fAdditionalCascadesScale));
|
||||
MOCK_METHOD1(SetRecomputeCachedShadows,
|
||||
void(uint));
|
||||
MOCK_METHOD0(CheckMemoryHeap,
|
||||
void());
|
||||
MOCK_METHOD1(DeleteEntityDecals,
|
||||
void(IRenderNode* pEntity));
|
||||
MOCK_METHOD0(LockCGFResources,
|
||||
void());
|
||||
MOCK_METHOD0(UnlockCGFResources,
|
||||
void());
|
||||
MOCK_METHOD0(FreeUnusedCGFResources,
|
||||
void());
|
||||
MOCK_METHOD0(CreateStatObj,
|
||||
IStatObj*());
|
||||
MOCK_METHOD1(CreateStatObjOptionalIndexedMesh,
|
||||
IStatObj*(bool createIndexedMesh));
|
||||
MOCK_METHOD0(CreateIndexedMesh,
|
||||
IIndexedMesh*());
|
||||
MOCK_METHOD1(SerializeState,
|
||||
void(TSerialize ser));
|
||||
MOCK_METHOD1(PostSerialize,
|
||||
void(bool bReading));
|
||||
MOCK_METHOD0(GetMaterialHelpers,
|
||||
IMaterialHelpers&());
|
||||
MOCK_METHOD0(GetMaterialManager,
|
||||
IMaterialManager*());
|
||||
MOCK_METHOD0(GetObjManager,
|
||||
IObjManager*());
|
||||
MOCK_METHOD1(CreateChunkfileContent,
|
||||
CContentCGF*(const char* filename));
|
||||
MOCK_METHOD1(ReleaseChunkfileContent,
|
||||
void(CContentCGF*));
|
||||
MOCK_METHOD4(LoadChunkFileContent,
|
||||
bool(CContentCGF* pCGF, const char* filename, bool bNoWarningMode, bool bCopyChunkFile));
|
||||
MOCK_METHOD6(LoadChunkFileContentFromMem,
|
||||
bool(CContentCGF* pCGF, const void* pData, size_t nDataLen, uint32 nLoadingFlags, bool bNoWarningMode, bool bCopyChunkFile));
|
||||
MOCK_METHOD1(CreateChunkFile,
|
||||
IChunkFile*(bool));
|
||||
MOCK_CONST_METHOD3(CreateChunkFileWriter,
|
||||
ChunkFile::IChunkFileWriter*(EChunkFileFormat eFormat, AZ::IO::IArchive* pPak, const char* filename));
|
||||
MOCK_CONST_METHOD1(ReleaseChunkFileWriter,
|
||||
void(ChunkFile::IChunkFileWriter* p));
|
||||
MOCK_METHOD2(CreateOcean,
|
||||
bool(_smart_ptr<IMaterial> pTerrainWaterMat, float waterLevel));
|
||||
MOCK_METHOD0(DeleteOcean,
|
||||
void());
|
||||
MOCK_METHOD1(ChangeOceanMaterial,
|
||||
void(_smart_ptr<IMaterial> pMat));
|
||||
MOCK_METHOD1(ChangeOceanWaterLevel,
|
||||
void(float fWaterLevel));
|
||||
MOCK_METHOD1(InitMaterialDefautMappingAxis
|
||||
, void(_smart_ptr<IMaterial> pMat));
|
||||
MOCK_METHOD0(GetIVisAreaManager,
|
||||
IVisAreaManager*());
|
||||
MOCK_METHOD3(PrecacheLevel,
|
||||
void(bool bPrecacheAllVisAreas, Vec3* pPrecachePoints, int nPrecachePointsNum));
|
||||
MOCK_METHOD0(ProposeContentPrecache,
|
||||
void());
|
||||
MOCK_METHOD0(GetTimeOfDay,
|
||||
ITimeOfDay*());
|
||||
MOCK_METHOD1(SetSkyMaterialPath,
|
||||
void(const string& skyMaterialPath));
|
||||
MOCK_METHOD1(SetSkyLowSpecMaterialPath,
|
||||
void(const string& skyMaterialPath));
|
||||
MOCK_METHOD0(LoadSkyMaterial,
|
||||
void());
|
||||
MOCK_METHOD0(GetSkyMaterial,
|
||||
_smart_ptr<IMaterial>());
|
||||
MOCK_METHOD1(SetSkyMaterial,
|
||||
void(_smart_ptr<IMaterial> pSkyMat));
|
||||
MOCK_METHOD2(SetGlobalParameter,
|
||||
void(E3DEngineParameter param, const Vec3& v));
|
||||
MOCK_METHOD2(GetGlobalParameter,
|
||||
void(E3DEngineParameter param, Vec3& v));
|
||||
MOCK_METHOD1(SetShadowMode,
|
||||
void(EShadowMode shadowMode));
|
||||
MOCK_CONST_METHOD0(GetShadowMode,
|
||||
EShadowMode());
|
||||
MOCK_METHOD6(AddPerObjectShadow,
|
||||
void(IShadowCaster* pCaster, float fConstBias, float fSlopeBias, float fJitter, const Vec3& vBBoxScale, uint nTexSize));
|
||||
MOCK_METHOD1(RemovePerObjectShadow,
|
||||
void(IShadowCaster* pCaster));
|
||||
MOCK_METHOD1(GetPerObjectShadow,
|
||||
struct SPerObjectShadow*(IShadowCaster* pCaster));
|
||||
MOCK_METHOD2(GetCustomShadowMapFrustums,
|
||||
void(struct ShadowMapFrustum*& arrFrustums, int& nFrustumCount));
|
||||
MOCK_METHOD2(SaveStatObj,
|
||||
int(IStatObj* pStatObj, TSerialize ser));
|
||||
MOCK_METHOD1(LoadStatObj,
|
||||
IStatObj*(TSerialize ser));
|
||||
MOCK_METHOD2(CheckIntersectClouds,
|
||||
bool(const Vec3& p1, const Vec3& p2));
|
||||
MOCK_METHOD1(OnRenderMeshDeleted,
|
||||
void(IRenderMesh* pRenderMesh));
|
||||
MOCK_METHOD0(DebugDraw_UpdateDebugNode,
|
||||
void());
|
||||
MOCK_METHOD4(RayObjectsIntersection2D,
|
||||
bool(Vec3 vStart, Vec3 vEnd, Vec3& vHitPoint, EERType eERType));
|
||||
MOCK_METHOD3(RenderMeshRayIntersection,
|
||||
bool(IRenderMesh* pRenderMesh, SRayHitInfo& hitInfo, _smart_ptr<IMaterial> pCustomMtl));
|
||||
MOCK_METHOD3(CheckCreateRNTmpData
|
||||
, void(CRNTmpData** ppInfo, IRenderNode* pRNode, const SRenderingPassInfo& passInfo));
|
||||
MOCK_METHOD1(FreeRNTmpData,
|
||||
void(CRNTmpData** ppInfo));
|
||||
MOCK_METHOD0(IsObjectTreeReady
|
||||
, bool());
|
||||
MOCK_METHOD0(GetIObjectTree
|
||||
, IOctreeNode*());
|
||||
MOCK_METHOD2(GetObjectsByType,
|
||||
uint32(EERType, IRenderNode**));
|
||||
MOCK_METHOD4(GetObjectsByTypeInBox,
|
||||
uint32(EERType objType, const AABB& bbox, IRenderNode** pObjects, ObjectTreeQueryFilterCallback filterCallback));
|
||||
MOCK_METHOD2(GetObjectsInBox,
|
||||
uint32(const AABB& bbox, IRenderNode** pObjects));
|
||||
MOCK_METHOD2(GetObjectsByFlags,
|
||||
uint32(uint, IRenderNode**));
|
||||
MOCK_METHOD4(GetObjectsByTypeInBox,
|
||||
void(EERType objType, const AABB& bbox, PodArray<IRenderNode*>* pLstObjects, ObjectTreeQueryFilterCallback filterCallback));
|
||||
MOCK_METHOD2(OnObjectModified,
|
||||
void(IRenderNode* pRenderNode, uint dwFlags));
|
||||
MOCK_METHOD1(FillDebugFPSInfo,
|
||||
void(SDebugFPSInfo&));
|
||||
MOCK_METHOD0(GetLevelFolder,
|
||||
const char*());
|
||||
MOCK_METHOD0(IsAreaActivationInUse,
|
||||
bool());
|
||||
MOCK_METHOD3(RenderRenderNode_ShadowPass,
|
||||
void(IShadowCaster* pRNode, const SRenderingPassInfo& passInfo, AZ::LegacyJobExecutor* pJobExecutor));
|
||||
MOCK_METHOD0(GetOpticsManager,
|
||||
IOpticsManager*());
|
||||
MOCK_METHOD0(SyncProcessStreamingUpdate,
|
||||
void());
|
||||
MOCK_METHOD1(SetScreenshotCallback,
|
||||
void(IScreenshotCallback* pCallback));
|
||||
MOCK_METHOD8(ActivateObjectsLayer,
|
||||
void(uint16 nLayerId, bool bActivate, bool bPhys, bool bObjects, bool bStaticLights, const char* pLayerName, IGeneralMemoryHeap* pHeap, bool bCheckLayerActivation));
|
||||
MOCK_CONST_METHOD4(GetLayerMemoryUsage,
|
||||
void(uint16 nLayerId, ICrySizer* pSizer, int* pNumBrushes, int* pNumDecals));
|
||||
MOCK_METHOD2(SkipLayerLoading,
|
||||
void(uint16 nLayerId, bool bClearList));
|
||||
MOCK_METHOD2(PrecacheRenderNode,
|
||||
void(IRenderNode* pObj, float fEntDistanceReal));
|
||||
MOCK_METHOD0(GetDeferredPhysicsEventManager,
|
||||
IDeferredPhysicsEventManager*());
|
||||
MOCK_METHOD1(SetStreamableListener,
|
||||
void(IStreamedObjectListener* pListener));
|
||||
MOCK_METHOD1(GetRenderingPassCamera,
|
||||
CCamera*(const CCamera& rCamera));
|
||||
MOCK_METHOD3(GetSvoStaticTextures,
|
||||
void(I3DEngine::SSvoStaticTexInfo& svoInfo, PodArray<I3DEngine::SLightTI>* pLightsTI_S, PodArray<I3DEngine::SLightTI>* pLightsTI_D));
|
||||
MOCK_METHOD2(GetSvoBricksForUpdate,
|
||||
void(PodArray<SSvoNodeInfo>& arrNodeInfo, bool getDynamic));
|
||||
#if defined(USE_GEOM_CACHES)
|
||||
MOCK_METHOD1(LoadGeomCache,
|
||||
IGeomCache*(const char* szFileName));
|
||||
MOCK_METHOD1(FindGeomCacheByFilename,
|
||||
IGeomCache*(const char* szFileName));
|
||||
#endif
|
||||
MOCK_METHOD3(LoadDesignerObject,
|
||||
IStatObj*(int nVersion, const char* szBinaryStream, int size));
|
||||
|
||||
MOCK_METHOD0(WaitForCullingJobsCompletion,
|
||||
void());
|
||||
};
|
||||
|
||||
@ -1,215 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(WIN32)
|
||||
#include "CryWindows.h"
|
||||
#include "IRenderer.h"
|
||||
#include "IImage.h"
|
||||
#include "smartptr.h"
|
||||
#include "ImageExtensionHelper.h"
|
||||
|
||||
// Types supported by CreateResourceFromTexture
|
||||
enum EResourceType
|
||||
{
|
||||
eResourceType_IconBig,
|
||||
eResourceType_IconSmall,
|
||||
eResourceType_Cursor,
|
||||
};
|
||||
|
||||
// Loads a (DDS) texture resource from the renderer into a Win32 GDI resource.
|
||||
// Returns a HICON that must be closed with DestroyIcon(), or NULL on failure.
|
||||
static HICON CreateResourceFromTexture(IRenderer* pRenderer, const char* path, EResourceType type)
|
||||
{
|
||||
if (!pRenderer || !path || !*path)
|
||||
{
|
||||
// Invalid parameter passed
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Find the target dimensions of the GDI resource
|
||||
const int nRequestedWidth = GetSystemMetrics(type == eResourceType_IconBig ? SM_CXICON : type == eResourceType_IconSmall ? SM_CXSMICON : SM_CXCURSOR);
|
||||
const int nRequestedHeight = GetSystemMetrics(type == eResourceType_IconBig ? SM_CYICON : type == eResourceType_IconSmall ? SM_CYSMICON : SM_CYCURSOR);
|
||||
if (nRequestedWidth != nRequestedHeight || nRequestedHeight <= 0 || nRequestedWidth <= 0)
|
||||
{
|
||||
// Don't support non-squares icons or cursors
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Load texture.
|
||||
// in this case, we want to fall back on a null, not substiture the missing texture.
|
||||
_smart_ptr<IImageFile> pImage = pRenderer->EF_LoadImage(path, FIM_NOFALLBACKS);
|
||||
if (!pImage || pImage->mfGet_depth() != 1 || pImage->mfGet_NumSides() != 1 || pImage->mfGetTileMode() != eTM_None)
|
||||
{
|
||||
// Can't load texture, or texture is a cube-map or volume texture, or uses tiling of some kind
|
||||
return NULL;
|
||||
}
|
||||
byte* pImgRaw = pImage->mfGet_image(0);
|
||||
const ETEX_Format texFormat = pImage->mfGetFormat();
|
||||
|
||||
// Pick first mip level smaller than the GDI resource
|
||||
int nMip = 0;
|
||||
size_t offset = 0;
|
||||
int nMipWidth = pImage->mfGet_width();
|
||||
int nMipHeight = pImage->mfGet_height();
|
||||
while (nMipWidth > nRequestedWidth)
|
||||
{
|
||||
++nMip;
|
||||
offset += pRenderer->GetTextureFormatDataSize(nMipWidth, nMipHeight, 1, 1, texFormat);
|
||||
nMipWidth = max(nMipWidth / 2, 1);
|
||||
nMipHeight = max(nMipHeight / 2, 1);
|
||||
}
|
||||
pImgRaw += offset;
|
||||
if (nMip >= pImage->mfGet_numMips())
|
||||
{
|
||||
// No appropriate mip in the texture
|
||||
// Note: Consider creating a full mip-chain on the texture so this can't happen
|
||||
return NULL;
|
||||
}
|
||||
const size_t nRawSize = pRenderer->GetTextureFormatDataSize(nMipWidth, nMipHeight, 1, 1, texFormat);
|
||||
|
||||
#if 0
|
||||
// Check that DDS indexing is correct here
|
||||
offset += nRawSize;
|
||||
for (int nIdx = nMip + 1; nIdx < pImage->mfGet_numMips(); ++nIdx)
|
||||
{
|
||||
const int w = max(nMipWidth >> (nIdx - nMip), 1);
|
||||
const int h = max(nMipHeight >> (nIdx - nMip), 1);
|
||||
offset += pRenderer->GetTextureFormatDataSize(w, h, 1, 1, texFormat);
|
||||
}
|
||||
assert(offset == pImage->mfGet_ImageSize());
|
||||
#endif
|
||||
|
||||
// Type of bitmap to create
|
||||
BITMAPV5HEADER bi = { 0 };
|
||||
bi.bV5Size = sizeof(BITMAPV5HEADER);
|
||||
bi.bV5Width = nRequestedWidth;
|
||||
bi.bV5Height = -nRequestedHeight;
|
||||
bi.bV5Planes = 1;
|
||||
bi.bV5BitCount = 32;
|
||||
bi.bV5Compression = BI_BITFIELDS;
|
||||
// The following mask specification specifies a supported 32 BPP alpha format for Windows XP+
|
||||
bi.bV5AlphaMask = 0xFF000000;
|
||||
bi.bV5RedMask = 0x00FF0000;
|
||||
bi.bV5GreenMask = 0x0000FF00;
|
||||
bi.bV5BlueMask = 0x000000FF;
|
||||
|
||||
// Create the DIB section with an alpha channel
|
||||
const HDC hdc = GetDC(NULL);
|
||||
void* lpBits;
|
||||
const HBITMAP hBitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bi, DIB_RGB_COLORS, &lpBits, NULL, 0);
|
||||
ReleaseDC(NULL, hdc);
|
||||
if (!hBitmap || !lpBits)
|
||||
{
|
||||
// Can't allocate OS bitmap
|
||||
return NULL;
|
||||
}
|
||||
GdiFlush();
|
||||
|
||||
// Decompress texture
|
||||
const bool bTryDecompress = texFormat != eTF_R8G8B8A8 && texFormat != eTF_B8G8R8A8 && texFormat != eTF_B8G8R8X8;
|
||||
byte* const pImgDecomp = bTryDecompress ? new byte[nMipWidth * nMipHeight * sizeof(int32)] : pImgRaw;
|
||||
const bool bImgDecompressed = bTryDecompress && pRenderer->DXTDecompress(pImgRaw, nRawSize, pImgDecomp, nMipWidth, nMipHeight, 1, texFormat, false, sizeof(int32));
|
||||
|
||||
// Check which conversions need to be performed
|
||||
const bool bSRGB = (pImage->mfGet_Flags() & CImageExtensionHelper::EIF_SRGBRead) != 0;
|
||||
const bool bSwap = (texFormat == eTF_R8G8B8A8) || bTryDecompress;
|
||||
|
||||
HICON result = NULL;
|
||||
if (!bTryDecompress || bImgDecompressed)
|
||||
{
|
||||
// Assign texture data with mismatching sizes
|
||||
// Note: Any pixels not in the selected mip will become 100% transparent black, no resizing is performed
|
||||
const size_t sourceRowStride = nMipWidth;
|
||||
const size_t targetRowStride = nRequestedWidth;
|
||||
const uint32* pSourceRow = (uint32*)pImgDecomp;
|
||||
uint32* pTargetRow = (uint32*)lpBits;
|
||||
|
||||
assert(sourceRowStride <= targetRowStride);
|
||||
assert(nMipHeight <= nRequestedHeight);
|
||||
assert(pSourceRow != pTargetRow);
|
||||
assert(pSourceRow && pTargetRow);
|
||||
|
||||
uint8 gammaTable[256];
|
||||
if (!bSRGB)
|
||||
{
|
||||
// Linear to sRGB table
|
||||
const float gamma = 1.0f / 2.2f;
|
||||
const float gammaMultiplier = 255.0f / powf(255.0f, gamma);
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
gammaTable[i] = uint8(powf(float(i), gamma) * gammaMultiplier);
|
||||
}
|
||||
}
|
||||
else if (bSwap)
|
||||
{
|
||||
// sRGB to sRGB table (no change)
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
gammaTable[i] = uint8(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < nMipHeight; ++y, pSourceRow += sourceRowStride, pTargetRow += targetRowStride)
|
||||
{
|
||||
if (!bSwap && bSRGB)
|
||||
{
|
||||
memcpy(pTargetRow, pSourceRow, sourceRowStride * sizeof(uint32));
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint32* pSourceTexel = pSourceRow;
|
||||
uint32* pTargetTexel = pTargetRow;
|
||||
for (int x = 0; x < nMipWidth; ++x, ++pSourceTexel, ++pTargetTexel)
|
||||
{
|
||||
const uint8 red = gammaTable[uint8(*pSourceTexel >> 0)];
|
||||
const uint8 green = gammaTable[uint8(*pSourceTexel >> 8)];
|
||||
const uint8 blue = gammaTable[uint8(*pSourceTexel >> 16)];
|
||||
const uint32 alpha = *pSourceTexel & 0xFF000000;
|
||||
*pTargetTexel = (red << (bSwap ? 16 : 0)) | (green << 8) | (blue << (bSwap ? 0 : 16)) | alpha;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill remaining columns with zeros
|
||||
memset(pTargetRow + sourceRowStride, 0, (targetRowStride - sourceRowStride) * sizeof(uint32));
|
||||
}
|
||||
|
||||
// Fill remaining rows with zeros
|
||||
for (int y = nMipHeight; y < nRequestedHeight; ++y)
|
||||
{
|
||||
memset(pTargetRow, 0, targetRowStride * sizeof(uint32));
|
||||
pTargetRow += targetRowStride;
|
||||
}
|
||||
|
||||
// Convert to GDI icon
|
||||
ICONINFO iconinfo = {0};
|
||||
iconinfo.fIcon = type == eResourceType_Cursor ? FALSE : TRUE;
|
||||
iconinfo.hbmMask = ::CreateBitmap(nRequestedWidth, nRequestedHeight, 1, 1, NULL);
|
||||
iconinfo.hbmColor = hBitmap;
|
||||
result = ::CreateIconIndirect(&iconinfo);
|
||||
DeleteObject(iconinfo.hbmMask);
|
||||
}
|
||||
|
||||
// Clean up
|
||||
DeleteObject(hBitmap);
|
||||
if (bTryDecompress)
|
||||
{
|
||||
delete[] pImgDecomp;
|
||||
}
|
||||
pImage.reset();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,245 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : Visual helper for checking a local memory usage on maps
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
|
||||
#define CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "../CryCommon/Cry_Geo.h"
|
||||
#include "ILocalMemoryUsage.h"
|
||||
#include "TimeValue.h"
|
||||
|
||||
#define LOCALMEMORY_SECTOR_SIZE 32.f //Size of one sector
|
||||
#define LOCALMEMORY_SECTOR_NR_X 128 //4096 / LOCALMEMORY_SECTOR_SIZE Sector number of the world (x)
|
||||
#define LOCALMEMORY_SECTOR_NR_Y 128 //4096 / LOCALMEMORY_SECTOR_SIZE Sector number of the world (y)
|
||||
#define LOCALMEMORY_SECTOR_PER_PASS 128 //4096 / 32 Sector nr for one calculation pass. Now it is the whole world;
|
||||
|
||||
//Sector number must be = LOCALMEMORY_SECTOR_PER_PASS * n
|
||||
|
||||
#define LOCALMEMORY_COLOR_OK 0, 255, 0
|
||||
#define LOCALMEMORY_COLOR_WARNING 255, 255, 0
|
||||
#define LOCALMEMORY_COLOR_ERROR 255, 0, 0
|
||||
#define LOCALMEMORY_COLOR_TEXTURE 0, 0, 255
|
||||
#define LOCALMEMORY_COLOR_GEOMETRY 0, 0, 0
|
||||
#define LOCALMEMORY_COLOR_BLACK 0, 0, 0, 192
|
||||
#define LOCALMEMORY_FCOLOR_OK 0, 1, 0
|
||||
#define LOCALMEMORY_FCOLOR_WARNING 1, 1, 0
|
||||
#define LOCALMEMORY_FCOLOR_ERROR 1, 0, 0
|
||||
#define LOCALMEMORY_FCOLOR_OTHER 0, 0, 1
|
||||
|
||||
struct IMaterial;
|
||||
struct IStatObj;
|
||||
struct IRenderMesh;
|
||||
struct IRenderNode;
|
||||
struct CRenderChunk;
|
||||
class CCamera;
|
||||
|
||||
#include <VectorMap.h>
|
||||
|
||||
struct CLocalMemoryUsage
|
||||
: public ILocalMemoryUsage
|
||||
{
|
||||
private:
|
||||
|
||||
struct STextureInfo;
|
||||
struct SMaterialInfo;
|
||||
struct SStatObjInfo;
|
||||
|
||||
typedef std__hash_map<INT_PTR, STextureInfo > TTextureMap; // Type: hash map of textures
|
||||
typedef std__hash_map<INT_PTR, SMaterialInfo> TMaterialMap; // Type: hash map of materials
|
||||
typedef std__hash_map<INT_PTR, SStatObjInfo > TStatObjMap; // Type: hash map of stat objects
|
||||
|
||||
//*******************
|
||||
|
||||
struct SResource
|
||||
{
|
||||
CLocalMemoryUsage* m_pLocalMemoryUsage; // Inner pointer to the singleton (we can use gEnv->pLocalMemoryUsage with type cast instead this)
|
||||
|
||||
float m_arrMipFactor[LOCALMEMORY_SECTOR_PER_PASS * LOCALMEMORY_SECTOR_PER_PASS]; // Mipmap factor based on minimum distance of the resource from the sector (bounding box distance)
|
||||
bool m_arrRowDirty[LOCALMEMORY_SECTOR_PER_PASS]; // Dirty flag for m_arrMipFactor rows
|
||||
bool m_used;
|
||||
|
||||
static int m_arrMemoryUsage[LOCALMEMORY_SECTOR_PER_PASS]; // Memory usage of the resource in sectors (last row)
|
||||
static int m_arrPieces[LOCALMEMORY_SECTOR_PER_PASS]; // Pieces nr of the resource in sectors (last row)
|
||||
|
||||
virtual void StartChecking(); // Called every frame first
|
||||
void CheckOnAllSectorsP1(const AABB& bounding, float maxViewDist, float viewDistMultiplierForLOD, float mipFactor); // Calculates the minimum of sector bounding vs renderobject bounding distances
|
||||
|
||||
SResource();
|
||||
virtual void Init(CLocalMemoryUsage* pLocalMemoryUsage);
|
||||
//If we will needed a destructor, it must be virtual!
|
||||
};
|
||||
|
||||
//*******************
|
||||
|
||||
struct STextureInfo
|
||||
: public SResource
|
||||
{
|
||||
ITexture* m_pTexture; // Texture pointer
|
||||
//int m_size; // For later use - Used memory
|
||||
//int m_xSize; // For later use - Texture x size
|
||||
//int m_ySize; // For later use - Texture y size
|
||||
//int m_numMips; // For later use - Number of mip maps
|
||||
|
||||
void CheckOnAllSectorsP2(); // Calculate memory usage using distances
|
||||
|
||||
STextureInfo();
|
||||
~STextureInfo();
|
||||
};
|
||||
|
||||
//*******************
|
||||
|
||||
struct STextureInfoAndTilingFactor
|
||||
{
|
||||
STextureInfo* m_pTextureInfo;
|
||||
float m_tilingFactor;
|
||||
};
|
||||
|
||||
typedef std::vector<STextureInfoAndTilingFactor> TTextureVector; // Type: vector of textures
|
||||
|
||||
struct SMaterialInfo
|
||||
: public SResource
|
||||
{
|
||||
//_smart_ptr<IMaterial> m_pMaterial; // For later use
|
||||
TTextureVector m_textures; // Used textures
|
||||
|
||||
SMaterialInfo();
|
||||
|
||||
void AddTextureInfo(STextureInfoAndTilingFactor texture);// Add a new texture (unique)
|
||||
void CheckOnAllSectorsP2(); // Forward distance informations to textures
|
||||
};
|
||||
|
||||
//*******************
|
||||
|
||||
struct SStatObjInfo
|
||||
: public SResource
|
||||
{
|
||||
int m_streamableContentMemoryUsage; // Total streamable memory usage
|
||||
//IStatObj *m_pStatObj; //TODO kiszedni
|
||||
string m_filePath; // The original file name and path of the StatObj
|
||||
bool m_bSubObject; // Is the original StatObj a subobject?
|
||||
/*
|
||||
int m_lodNr; // For later use
|
||||
int m_vertices;
|
||||
int m_meshSize;
|
||||
int m_physProxySize;
|
||||
int m_physPrimitives;
|
||||
int m_indices;
|
||||
int m_indicesPerLod[MAX_LODS];
|
||||
*/
|
||||
|
||||
SStatObjInfo();
|
||||
void CheckOnAllSectorsP2(); // Calculate memory usage using distances
|
||||
};
|
||||
|
||||
//*******************
|
||||
|
||||
struct SSector
|
||||
{
|
||||
SSector();
|
||||
|
||||
void StartChecking(); // Called every frame first
|
||||
|
||||
int m_memoryUsage_Textures; // Sum of texture memory usage
|
||||
|
||||
int m_memoryUsage_Geometry; // Sum of geometry memory usage
|
||||
};
|
||||
|
||||
//*******************
|
||||
PREFAST_SUPPRESS_WARNING(6262);
|
||||
TTextureMap m_globalTextures; // Hash map of resources: textures
|
||||
PREFAST_SUPPRESS_WARNING(6262);
|
||||
TMaterialMap m_globalMaterials; // Hash map of resources: materials
|
||||
PREFAST_SUPPRESS_WARNING(6262);
|
||||
TStatObjMap m_globalStatObjs; // Hash map of resources: stat objects
|
||||
|
||||
ICVar* m_pStreamCgfPredicitionDistance; // Config: additional object distance for streaming
|
||||
ICVar* m_pDebugDraw; // Config: debug draw mode
|
||||
|
||||
int sys_LocalMemoryTextureLimit; // Config: texture limit for streaming
|
||||
int sys_LocalMemoryGeometryLimit; // Config: stat object geometry limit for streaming
|
||||
int sys_LocalMemoryTextureStreamingSpeedLimit; // Config: texture streaming speed limit (approx)
|
||||
int sys_LocalMemoryGeometryStreamingSpeedLimit; // Config: stat object geometry streaming speed limit (approx)
|
||||
|
||||
float sys_LocalMemoryWarningRatio; // Config: Warning ratio for streaming
|
||||
float sys_LocalMemoryOuterViewDistance; // Config: View distance for debug draw
|
||||
float sys_LocalMemoryInnerViewDistance; // Config: View distance for detailed debug draw
|
||||
|
||||
float sys_LocalMemoryObjectWidth; // Config: Width of the debug object
|
||||
float sys_LocalMemoryObjectHeight; // Config: Height of the debug object
|
||||
int sys_LocalMemoryObjectAlpha; // Config: Color alpha of the debug object
|
||||
|
||||
float sys_LocalMemoryStreamingSpeedObjectLength; // Config: Length of the streaming speed debug object
|
||||
float sys_LocalMemoryStreamingSpeedObjectWidth; // Config: Width of the streaming speed debug object
|
||||
|
||||
float sys_LocalMemoryDiagramWidth; // Config: Width of the diagram
|
||||
|
||||
float sys_LocalMemoryDiagramRadius; // Config: Radius of the diagram
|
||||
float sys_LocalMemoryDiagramDistance; // Config: Distance of the diagram from the main debug object
|
||||
float sys_LocalMemoryDiagramStreamingSpeedRadius; // Config: Radius of the streaming speed diagram
|
||||
float sys_LocalMemoryDiagramStreamingSpeedDistance; // Config: Distance of the streaming speed diagram from the streaming speed debug line
|
||||
int sys_LocalMemoryDiagramAlpha; // Config: Color alpha of the diagram
|
||||
|
||||
int sys_LocalMemoryDrawText; // Config: If != 0, it will draw the numeric values
|
||||
int sys_LocalMemoryLogText; // Config: If != 0, it will log the numeric values
|
||||
|
||||
int sys_LocalMemoryOptimalMSecPerSec; // Config: Optimal calculation time (MSec) per secundum
|
||||
int sys_LocalMemoryMaxMSecBetweenCalls; // Config: Maximal time difference (MSec) between calls
|
||||
|
||||
RectI m_actProcessedSectors; // Processed sectors (now it is the whole world)
|
||||
RectI m_actDrawedSectors; // Processed sectors (now it is the whole world)
|
||||
|
||||
Vec2i m_sectorNr; // Sector x and y number
|
||||
|
||||
float m_AverageUpdateTime; // Avarage Update() time (MSec)
|
||||
CTimeValue m_LastCallTime; // Last call time of Update()
|
||||
|
||||
SSector m_arrSectors[LOCALMEMORY_SECTOR_NR_X * LOCALMEMORY_SECTOR_NR_Y]; // Sectors
|
||||
|
||||
public:
|
||||
|
||||
CLocalMemoryUsage();
|
||||
~CLocalMemoryUsage();
|
||||
|
||||
virtual void OnRender(IRenderer* pRenderer, const CCamera* camera);
|
||||
virtual void OnUpdate();
|
||||
virtual void DeleteGlobalData(); // Deletes the m_globalXXX hash maps
|
||||
|
||||
private:
|
||||
void DeleteUnusedResources(); // Delete the non-used resources (especially StatObjs)
|
||||
void StartChecking(const RectI& actProcessedSectors); // Called every frame first
|
||||
void CollectGeometryP1(); // Calculates the minimum of sector bounding vs renderobject bounding distances
|
||||
|
||||
// Get / create StatObjInfo then run Pass1
|
||||
SStatObjInfo* CheckStatObjP1(IStatObj* pStatObj, IRenderNode* pRenderNode, AABB bounding, float maxViewDist, float scale);
|
||||
//void CollectStatObjInfo_Recursive( SStatObjInfo* statObjInfo, IStatObj *pStatObj );
|
||||
//void CollectGeometryInfo( SStatObjInfo* statObjInfo, IStatObj *pStatObj );
|
||||
|
||||
// Get / create MaterialInfo then run Pass1
|
||||
void CheckMaterialP1(_smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale, float mipFactor);
|
||||
void CheckChunkMaterialP1(_smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale, CRenderChunk* pRenderChunk);
|
||||
void CheckMeshMaterialP1(IRenderMesh* pRenderMesh, _smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale);
|
||||
void CheckStatObjMaterialP1(IStatObj* pStatObj, _smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale);
|
||||
// Collects textures used by the material
|
||||
void CollectMaterialInfo_Recursive(SMaterialInfo* materialInfo, _smart_ptr<IMaterial> pMaterial);
|
||||
|
||||
// Get / create TextureInfo
|
||||
STextureInfo* GetTextureInfo(ITexture* pTexture);
|
||||
};
|
||||
|
||||
#undef MAX_LODS
|
||||
#endif // CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
|
||||
@ -1,409 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LegacyPreviewer.h"
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/AssetBrowser/EBusFindAssetTypeByName.h>
|
||||
|
||||
// Editor
|
||||
#include "Util/Image.h"
|
||||
#include "Util/ImageUtil.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <AzAssetBrowser/Preview/ui_LegacyPreviewer.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
|
||||
static const int s_CharWidth = 6;
|
||||
const QString LegacyPreviewer::Name{ QStringLiteral("LegacyPreviewer") };
|
||||
|
||||
LegacyPreviewer::LegacyPreviewer(QWidget* parent)
|
||||
: Previewer(parent)
|
||||
, m_ui(new Ui::LegacyPreviewerClass())
|
||||
, m_textureType(TextureType::RGB)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->m_comboBoxRGB->addItems(QStringList() << "RGB" << "RGBA" << "Alpha");
|
||||
m_ui->m_previewCtrl->SetAspectRatio(4.0f / 3.0f);
|
||||
connect(m_ui->m_comboBoxRGB, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), this,
|
||||
[=](int index)
|
||||
{
|
||||
m_textureType = static_cast<TextureType>(index);
|
||||
UpdateTextureType();
|
||||
});
|
||||
Clear();
|
||||
}
|
||||
|
||||
LegacyPreviewer::~LegacyPreviewer()
|
||||
{
|
||||
}
|
||||
|
||||
void LegacyPreviewer::Clear() const
|
||||
{
|
||||
m_ui->m_previewCtrl->ReleaseObject();
|
||||
m_ui->m_modelPreviewWidget->hide();
|
||||
m_ui->m_texturePreviewWidget->hide();
|
||||
m_ui->m_fileInfoCtrl->hide();
|
||||
}
|
||||
|
||||
void LegacyPreviewer::Display(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry)
|
||||
{
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (entry->GetEntryType())
|
||||
{
|
||||
case AssetBrowserEntry::AssetEntryType::Source:
|
||||
{
|
||||
const SourceAssetBrowserEntry* sourceEntry = azrtti_cast<const SourceAssetBrowserEntry*>(entry);
|
||||
DisplaySource(sourceEntry);
|
||||
break;
|
||||
}
|
||||
case AssetBrowserEntry::AssetEntryType::Product:
|
||||
DisplayProduct(static_cast<const ProductAssetBrowserEntry*>(entry));
|
||||
break;
|
||||
default:
|
||||
Clear();
|
||||
}
|
||||
}
|
||||
|
||||
const QString& LegacyPreviewer::GetName() const
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
void LegacyPreviewer::resizeEvent(QResizeEvent* /*event*/)
|
||||
{
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
}
|
||||
|
||||
bool LegacyPreviewer::DisplayProduct(const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry* product)
|
||||
{
|
||||
m_ui->m_fileInfoCtrl->show();
|
||||
|
||||
m_fileinfo = QString::fromUtf8(product->GetName().c_str());
|
||||
|
||||
m_fileinfo += GetFileSize(product->GetRelativePath().c_str());
|
||||
|
||||
EBusFindAssetTypeByName meshAssetTypeResult("Static Mesh");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(meshAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
|
||||
QString filename(product->GetRelativePath().c_str());
|
||||
|
||||
// Find item.
|
||||
if (product->GetAssetType() == meshAssetTypeResult.GetAssetType())
|
||||
{
|
||||
m_ui->m_modelPreviewWidget->show();
|
||||
m_ui->m_texturePreviewWidget->hide();
|
||||
m_ui->m_previewCtrl->LoadFile(filename);
|
||||
|
||||
int nVertexCount = m_ui->m_previewCtrl->GetVertexCount();
|
||||
int nFaceCount = m_ui->m_previewCtrl->GetFaceCount();
|
||||
int nMaxLod = m_ui->m_previewCtrl->GetMaxLod();
|
||||
int nMtls = m_ui->m_previewCtrl->GetMtlCount();
|
||||
if (nFaceCount > 0)
|
||||
{
|
||||
m_fileinfo += tr("\r\n%1 Faces\r\n%2 Verts\r\n%3 MaxLod\r\n%4 Materials").arg(nFaceCount).arg(nVertexCount).arg(nMaxLod).arg(nMtls);
|
||||
}
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
updateGeometry();
|
||||
return true;
|
||||
}
|
||||
|
||||
EBusFindAssetTypeByName textureAssetTypeResult("Texture");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
|
||||
if (product->GetAssetType() == textureAssetTypeResult.GetAssetType())
|
||||
{
|
||||
// Get full product file path
|
||||
const char* assetCachePath = AZ::IO::FileIOBase::GetInstance()->GetAlias("@assets@");
|
||||
AZStd::string productFullPath;
|
||||
AzFramework::StringFunc::Path::Join(assetCachePath, product->GetRelativePath().c_str(), productFullPath);
|
||||
if (AZ::IO::FileIOBase::GetInstance()->Exists(productFullPath.c_str()))
|
||||
{
|
||||
// Try to display it in modern dds image loader, if no one exists, use the legacy image loader
|
||||
bool foundPixmap = DisplayTextureProductModern(productFullPath.c_str());
|
||||
return foundPixmap ? foundPixmap : DisplayTextureLegacy(productFullPath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we cannot find the product file, means it's not treated as an asset, display its source
|
||||
return DisplayTextureLegacy(product->GetFullPath().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
void LegacyPreviewer::DisplaySource(const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* source)
|
||||
{
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
EBusFindAssetTypeByName textureAssetType("Texture");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetType, &AZ::AssetTypeInfo::GetAssetType);
|
||||
|
||||
if (source->GetPrimaryAssetType() == textureAssetType.GetAssetType())
|
||||
{
|
||||
m_ui->m_fileInfoCtrl->show();
|
||||
m_fileinfo = QString::fromUtf8(source->GetName().c_str());
|
||||
m_fileinfo += GetFileSize(source->GetFullPath().c_str());
|
||||
const char* fullSourcePath = source->GetFullPath().c_str();
|
||||
// If it's a source dds file, try to display it using modern way
|
||||
if (AzFramework::StringFunc::Path::IsExtension(fullSourcePath, "dds", false))
|
||||
{
|
||||
if (DisplayTextureProductModern(fullSourcePath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
DisplayTextureLegacy(source->GetFullPath().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::vector<const ProductAssetBrowserEntry*> products;
|
||||
source->GetChildrenRecursively<ProductAssetBrowserEntry>(products);
|
||||
if (products.empty())
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto* product : products)
|
||||
{
|
||||
if (DisplayProduct(product))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString LegacyPreviewer::GetFileSize(const char* path)
|
||||
{
|
||||
QString fileSizeStr;
|
||||
AZ::u64 fileSizeResult = 0;
|
||||
if (AZ::IO::FileIOBase::GetInstance()->Size(path, fileSizeResult))
|
||||
{
|
||||
static double kb = 1024.0f;
|
||||
static double mb = kb * 1024.0;
|
||||
static double gb = mb * 1024.0;
|
||||
|
||||
static QString byteStr = "B";
|
||||
static QString kbStr = "KB";
|
||||
static QString mbStr = "MB";
|
||||
static QString gbStr = "GB";
|
||||
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
kb = 1000.0;
|
||||
mb = kb * 1000.0;
|
||||
gb = mb * 1000.0;
|
||||
|
||||
kbStr = "kB";
|
||||
mbStr = "mB";
|
||||
gbStr = "gB";
|
||||
#endif // AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
|
||||
if (fileSizeResult < kb)
|
||||
{
|
||||
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(fileSizeResult), byteStr);
|
||||
}
|
||||
else if (fileSizeResult < mb)
|
||||
{
|
||||
double size = fileSizeResult / kb;
|
||||
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), kbStr);
|
||||
}
|
||||
else if (fileSizeResult < gb)
|
||||
{
|
||||
double size = fileSizeResult / mb;
|
||||
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), mbStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
double size = fileSizeResult / gb;
|
||||
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), gbStr);
|
||||
}
|
||||
}
|
||||
return fileSizeStr;
|
||||
}
|
||||
|
||||
bool LegacyPreviewer::DisplayTextureLegacy(const char* fullImagePath)
|
||||
{
|
||||
m_ui->m_modelPreviewWidget->hide();
|
||||
m_ui->m_texturePreviewWidget->show();
|
||||
|
||||
bool foundPixmap = false;
|
||||
if (!AZ::IO::FileIOBase::GetInstance()->IsDirectory(fullImagePath))
|
||||
{
|
||||
QString strLoadFilename = QString(fullImagePath);
|
||||
if (CImageUtil::LoadImage(strLoadFilename, m_previewImageSource))
|
||||
{
|
||||
m_fileinfo += QStringLiteral("\r\n%1x%2\r\n%3")
|
||||
.arg(m_previewImageSource.GetWidth())
|
||||
.arg(m_previewImageSource.GetHeight())
|
||||
.arg(m_previewImageSource.GetFormatDescription());
|
||||
|
||||
m_fileinfoAlphaTexture = m_fileinfo;
|
||||
UpdateTextureType();
|
||||
foundPixmap = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundPixmap)
|
||||
{
|
||||
m_ui->m_previewImageCtrl->setPixmap(QPixmap());
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
}
|
||||
|
||||
updateGeometry();
|
||||
|
||||
return foundPixmap;
|
||||
}
|
||||
|
||||
bool LegacyPreviewer::DisplayTextureProductModern(const char* fullProductImagePath)
|
||||
{
|
||||
m_ui->m_modelPreviewWidget->hide();
|
||||
m_ui->m_texturePreviewWidget->show();
|
||||
|
||||
bool foundPixmap = false;
|
||||
QImage previewImage;
|
||||
AZStd::string productInfo;
|
||||
AZStd::string productAlphaInfo;
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserTexturePreviewRequestsBus::BroadcastResult(foundPixmap, &AzToolsFramework::AssetBrowser::AssetBrowserTexturePreviewRequests::GetProductTexturePreview, fullProductImagePath, previewImage, productInfo, productAlphaInfo);
|
||||
|
||||
if (foundPixmap)
|
||||
{
|
||||
QPixmap pix = QPixmap::fromImage(previewImage);
|
||||
m_ui->m_previewImageCtrl->setPixmap(pix);
|
||||
m_ui->m_previewImageCtrl->updateGeometry();
|
||||
CImageUtil::QImageToImage(previewImage, m_previewImageSource);
|
||||
|
||||
m_fileinfo += QStringLiteral("\r\n%1x%2\r\n%3")
|
||||
.arg(m_previewImageSource.GetWidth())
|
||||
.arg(m_previewImageSource.GetHeight())
|
||||
.arg(m_previewImageSource.GetFormatDescription());
|
||||
|
||||
m_fileinfoAlphaTexture = m_fileinfo;
|
||||
|
||||
m_fileinfo += QString(productInfo.c_str());
|
||||
if (productAlphaInfo.empty())
|
||||
{
|
||||
// If there is no separate info for alpha, use the image info
|
||||
m_fileinfoAlphaTexture += QString(productInfo.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileinfoAlphaTexture += QString(productAlphaInfo.c_str());
|
||||
}
|
||||
|
||||
|
||||
UpdateTextureType();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->m_previewImageCtrl->setPixmap(QPixmap());
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
}
|
||||
|
||||
updateGeometry();
|
||||
return foundPixmap;
|
||||
}
|
||||
|
||||
void LegacyPreviewer::UpdateTextureType()
|
||||
{
|
||||
m_previewImageUpdated.Copy(m_previewImageSource);
|
||||
|
||||
switch (m_textureType)
|
||||
{
|
||||
case TextureType::RGB:
|
||||
{
|
||||
m_previewImageUpdated.SwapRedAndBlue();
|
||||
m_previewImageUpdated.FillAlpha();
|
||||
break;
|
||||
}
|
||||
case TextureType::RGBA:
|
||||
{
|
||||
m_previewImageUpdated.SwapRedAndBlue();
|
||||
break;
|
||||
}
|
||||
case TextureType::Alpha:
|
||||
{
|
||||
for (int h = 0; h < m_previewImageUpdated.GetHeight(); h++)
|
||||
{
|
||||
for (int w = 0; w < m_previewImageUpdated.GetWidth(); w++)
|
||||
{
|
||||
int a = m_previewImageUpdated.ValueAt(w, h) >> 24;
|
||||
m_previewImageUpdated.ValueAt(w, h) = RGB(a, a, a) | 0xFF000000;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// note that Qt will not deep copy the data, so WE MUST KEEP THE IMAGE DATA AROUND!
|
||||
QPixmap qtPixmap = QPixmap::fromImage(
|
||||
QImage(reinterpret_cast<uchar*>(m_previewImageUpdated.GetData()), m_previewImageUpdated.GetWidth(), m_previewImageUpdated.GetHeight(), QImage::Format_ARGB32));
|
||||
m_ui->m_previewImageCtrl->setPixmap(qtPixmap);
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_textureType == TextureType::Alpha? m_fileinfoAlphaTexture: m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
m_ui->m_previewImageCtrl->updateGeometry();
|
||||
}
|
||||
|
||||
bool LegacyPreviewer::FileInfoCompare(const FileInfo& f1, const FileInfo& f2)
|
||||
{
|
||||
if ((f1.attrib & _A_SUBDIR) && !(f2.attrib & _A_SUBDIR))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!(f1.attrib & _A_SUBDIR) && (f2.attrib & _A_SUBDIR))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return QString::compare(f1.filename, f2.filename, Qt::CaseInsensitive) < 0;
|
||||
}
|
||||
|
||||
QString LegacyPreviewer::WordWrap(const QString& string, int maxLength)
|
||||
{
|
||||
QString result;
|
||||
int length = 0;
|
||||
|
||||
for (auto c : string)
|
||||
{
|
||||
if (c == '\n')
|
||||
{
|
||||
length = 0;
|
||||
}
|
||||
else if (length > maxLength)
|
||||
{
|
||||
result.append('\n');
|
||||
length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
length++;
|
||||
}
|
||||
result.append(c);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#include <AzAssetBrowser/Preview/moc_LegacyPreviewer.cpp>
|
||||
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <Editor/Util/Image.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Previewer/Previewer.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class LegacyPreviewerClass;
|
||||
}
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace AssetBrowser
|
||||
{
|
||||
class ProductAssetBrowserEntry;
|
||||
class SourceAssetBrowserEntry;
|
||||
class AssetBrowserEntry;
|
||||
}
|
||||
}
|
||||
|
||||
class QResizeEvent;
|
||||
|
||||
class LegacyPreviewer
|
||||
: public AzToolsFramework::AssetBrowser::Previewer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(LegacyPreviewer, AZ::SystemAllocator, 0);
|
||||
|
||||
explicit LegacyPreviewer(QWidget* parent = nullptr);
|
||||
~LegacyPreviewer();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzToolsFramework::AssetBrowser::Previewer
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Clear() const override;
|
||||
void Display(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) override;
|
||||
const QString& GetName() const override;
|
||||
|
||||
static const QString Name;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent * event) override;
|
||||
|
||||
private:
|
||||
struct FileInfo
|
||||
{
|
||||
QString filename;
|
||||
unsigned attrib;
|
||||
time_t time_create; /* -1 for FAT file systems */
|
||||
time_t time_access; /* -1 for FAT file systems */
|
||||
time_t time_write;
|
||||
_fsize_t size;
|
||||
};
|
||||
|
||||
enum class TextureType
|
||||
{
|
||||
RGB,
|
||||
RGBA,
|
||||
Alpha
|
||||
};
|
||||
|
||||
QScopedPointer<Ui::LegacyPreviewerClass> m_ui;
|
||||
CImageEx m_previewImageSource;
|
||||
CImageEx m_previewImageUpdated;
|
||||
TextureType m_textureType;
|
||||
QString m_fileinfo;
|
||||
QString m_fileinfoAlphaTexture;
|
||||
|
||||
bool DisplayProduct(const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry* product);
|
||||
void DisplaySource(const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* source);
|
||||
|
||||
QString GetFileSize(const char* path);
|
||||
|
||||
bool DisplayTextureLegacy(const char* fullImagePath);
|
||||
bool DisplayTextureProductModern(const char* fullProductImagePath);
|
||||
|
||||
void UpdateTextureType();
|
||||
|
||||
static bool FileInfoCompare(const FileInfo& f1, const FileInfo& f2);
|
||||
//! QLabel word wrap does not break long words such as filenames, so manual word wrap needed
|
||||
static QString WordWrap(const QString& string, int maxLength);
|
||||
};
|
||||
@ -1,176 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LegacyPreviewerClass</class>
|
||||
<widget class="QWidget" name="LegacyPreviewerClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>148</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_texturePreviewWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="m_horizontalLayout">
|
||||
<item>
|
||||
<spacer name="m_horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_comboBoxRGB">
|
||||
<property name="currentText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AzToolsFramework::AspectRatioAwarePixmapWidget" name="m_previewImageCtrl" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_modelPreviewWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="CPreviewModelCtrl" name="m_previewCtrl" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_fileInfoCtrl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="m_verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CPreviewModelCtrl</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Controls/PreviewModelCtrl.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AzToolsFramework::AspectRatioAwarePixmapWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>AzToolsFramework/UI/UICore/AspectRatioAwarePixmapWidget.hxx</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "LegacyPreviewerFactory.h"
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h> // for AssetBrowserEntry::AssetEntryType
|
||||
#include <AzToolsFramework/AssetBrowser/EBusFindAssetTypeByName.h> // for EBusFindAssetTypeByName
|
||||
|
||||
// Editor
|
||||
#include "LegacyPreviewer.h"
|
||||
|
||||
|
||||
AzToolsFramework::AssetBrowser::Previewer* LegacyPreviewerFactory::CreatePreviewer(QWidget* parent) const
|
||||
{
|
||||
return new LegacyPreviewer(parent);
|
||||
}
|
||||
|
||||
bool LegacyPreviewerFactory::IsEntrySupported(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const
|
||||
{
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
EBusFindAssetTypeByName meshAssetTypeResult("Static Mesh");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(meshAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
EBusFindAssetTypeByName textureAssetTypeResult("Texture");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
|
||||
switch (entry->GetEntryType())
|
||||
{
|
||||
case AssetBrowserEntry::AssetEntryType::Source:
|
||||
{
|
||||
const auto* source = azrtti_cast < const SourceAssetBrowserEntry * > (entry);
|
||||
if (source->GetPrimaryAssetType() == textureAssetTypeResult.GetAssetType())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
AZStd::vector < const ProductAssetBrowserEntry * > products;
|
||||
source->GetChildrenRecursively < ProductAssetBrowserEntry > (products);
|
||||
for (auto* product : products)
|
||||
{
|
||||
if (product->GetAssetType() == textureAssetTypeResult.GetAssetType() ||
|
||||
product->GetAssetType() == meshAssetTypeResult.GetAssetType())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AssetBrowserEntry::AssetEntryType::Product:
|
||||
const auto* product = azrtti_cast < const ProductAssetBrowserEntry * > (entry);
|
||||
return product->GetAssetType() == textureAssetTypeResult.GetAssetType() ||
|
||||
product->GetAssetType() == meshAssetTypeResult.GetAssetType();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString& LegacyPreviewerFactory::GetName() const
|
||||
{
|
||||
return LegacyPreviewer::Name;
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Previewer/PreviewerFactory.h>
|
||||
|
||||
class QString;
|
||||
|
||||
class LegacyPreviewerFactory final
|
||||
: public AzToolsFramework::AssetBrowser::PreviewerFactory
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(LegacyPreviewerFactory, AZ::SystemAllocator, 0);
|
||||
|
||||
LegacyPreviewerFactory() = default;
|
||||
~LegacyPreviewerFactory() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzToolsFramework::AssetBrowser::PreviewerFactory
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AzToolsFramework::AssetBrowser::Previewer* CreatePreviewer(QWidget* parent = nullptr) const override;
|
||||
bool IsEntrySupported(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const override;
|
||||
const QString& GetName() const override;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,198 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_CONTROLS_PREVIEWMODELCTRL_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_PREVIEWMODELCTRL_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QString>
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
|
||||
#include <IStatObj.h>
|
||||
|
||||
#endif
|
||||
|
||||
struct IRenderNode;
|
||||
class CImageEx;
|
||||
|
||||
class CPreviewModelCtrl
|
||||
: public QWidget
|
||||
, public IEditorNotifyListener
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CPreviewModelCtrl(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
||||
QSize minimumSizeHint() const override;
|
||||
|
||||
public:
|
||||
void LoadFile(const QString& modelFile, bool changeCamera = true);
|
||||
Vec3 GetSize() const { return m_size; };
|
||||
QString GetLoadedFile() const { return m_loadedFile; }
|
||||
|
||||
void SetEntity(IRenderNode* entity);
|
||||
void SetObject(IStatObj* pObject);
|
||||
IStatObj* GetObject() { return m_pObj; }
|
||||
void SetCameraLookAt(float fRadiusScale, const Vec3& dir = Vec3(0, 1, 0));
|
||||
void SetCameraRadius(float fRadius);
|
||||
CCamera& GetCamera();
|
||||
void SetGrid(bool bEnable) { m_bGrid = bEnable; }
|
||||
void SetAxis(bool bEnable, bool forParticleEditor = false) { m_bAxis = bEnable; m_bAxisParticleEditor = forParticleEditor; }
|
||||
void SetRotation(bool bEnable);
|
||||
void SetClearColor(const ColorF& color);
|
||||
void SetBackgroundTexture(const QString& textureFilename);
|
||||
void UseBackLight(bool bEnable);
|
||||
bool UseBackLight() const { return m_bUseBacklight; }
|
||||
void SetShowNormals(bool bShow) { m_bShowNormals = bShow; }
|
||||
void SetShowPhysics(bool bShow) { m_bShowPhysics = bShow; }
|
||||
void SetShowRenderInfo(bool bShow) { m_bShowRenderInfo = bShow; }
|
||||
|
||||
void EnableUpdate(bool bEnable);
|
||||
bool IsUpdateEnabled() const { return m_bUpdate; }
|
||||
void Update(bool bForceUpdate = false);
|
||||
void ProcessKeys();
|
||||
|
||||
// this turns on and off aspect-ratio-maintaining. Use it when the widget is free to resize itself.
|
||||
void SetAspectRatio(float newAspectRatio);
|
||||
int heightForWidth(int w) const override;
|
||||
bool hasHeightForWidth() const override;
|
||||
|
||||
void GetImageOffscreen(CImageEx& image, const QSize& customSize = QSize(0, 0));
|
||||
|
||||
void GetCameraTM(Matrix34& cameraTM);
|
||||
void SetCameraTM(const Matrix34& cameraTM);
|
||||
|
||||
// Place camera so that whole object fits on screen.
|
||||
void FitToScreen();
|
||||
|
||||
// Get information about the preview model.
|
||||
int GetFaceCount();
|
||||
int GetVertexCount();
|
||||
int GetMaxLod();
|
||||
int GetMtlCount();
|
||||
|
||||
void SetShowObject(bool bShowObject) {m_bShowObject = bShowObject; }
|
||||
bool GetShowObject() {return m_bShowObject; }
|
||||
|
||||
void SetAmbient(ColorF amb) { m_ambientColor = amb; }
|
||||
void SetAmbientMultiplier(f32 multiplier) { m_ambientMultiplier = multiplier; }
|
||||
|
||||
typedef void (* CameraChangeCallback)(void* m_userData, CPreviewModelCtrl* m_currentCamera);
|
||||
void SetCameraChangeCallback(CameraChangeCallback callback, void* userData) { m_cameraChangeCallback = callback, m_pCameraChangeUserData = userData; }
|
||||
|
||||
void EnableMaterialPrecaching(bool bPrecacheMaterial) { m_bPrecacheMaterial = bPrecacheMaterial; }
|
||||
void EnableWireframeRendering(bool bDrawWireframe) { m_bDrawWireFrame = bDrawWireframe; }
|
||||
|
||||
public:
|
||||
~CPreviewModelCtrl();
|
||||
|
||||
bool CreateContext();
|
||||
void ReleaseObject();
|
||||
void DeleteRenderContex();
|
||||
|
||||
protected:
|
||||
void OnCreate();
|
||||
void OnDestroy();
|
||||
void OnLButtonDown(QPoint point);
|
||||
void OnLButtonUp(QPoint point);
|
||||
void OnMButtonDown(QPoint point);
|
||||
void OnMButtonUp(QPoint point);
|
||||
void OnRButtonUp(QPoint point);
|
||||
void OnRButtonDown(QPoint point);
|
||||
|
||||
QPaintEngine* paintEngine() const override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void timerEvent(QTimerEvent* event) override;
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
|
||||
protected:
|
||||
virtual bool Render();
|
||||
virtual void SetCamera(CCamera& cam);
|
||||
|
||||
virtual void RenderObject(_smart_ptr<IMaterial> pMaterial, SRenderingPassInfo& passInfo);
|
||||
|
||||
HWND m_hWnd;
|
||||
CCamera m_camera;
|
||||
float m_fov;
|
||||
|
||||
struct SPreviousContext;
|
||||
std::vector<SPreviousContext> m_previousContexts;
|
||||
|
||||
void SetOrbitAngles(const Ang3& ang);
|
||||
void DrawGrid();
|
||||
void DrawBackground();
|
||||
_smart_ptr<IMaterial> GetCurrentMaterial();
|
||||
|
||||
_smart_ptr<IStatObj> m_pObj;
|
||||
|
||||
IRenderer* m_pRenderer;
|
||||
bool m_bContextCreated;
|
||||
|
||||
Vec3 m_size;
|
||||
Vec3 m_pos;
|
||||
int m_nTimer;
|
||||
bool m_useAspectRatio = false;
|
||||
float m_aspectRatio = 1.0f;
|
||||
|
||||
QString m_loadedFile;
|
||||
std::vector<CDLight> m_lights;
|
||||
|
||||
AABB m_aabb;
|
||||
Vec3 m_cameraTarget;
|
||||
float m_cameraRadius;
|
||||
Vec3 m_cameraAngles;
|
||||
bool m_bInRotateMode;
|
||||
bool m_bInMoveMode;
|
||||
bool m_bInPanMode;
|
||||
QPoint m_mousePosition;
|
||||
QPoint m_previousMousePosition;
|
||||
IRenderNode* m_pEntity;
|
||||
bool m_bHaveAnythingToRender;
|
||||
bool m_bGrid;
|
||||
bool m_bAxis;
|
||||
bool m_bAxisParticleEditor;
|
||||
bool m_bUpdate;
|
||||
bool m_bRotate;
|
||||
float m_rotateAngle;
|
||||
ColorF m_clearColor;
|
||||
ColorF m_ambientColor;
|
||||
f32 m_ambientMultiplier;
|
||||
bool m_bUseBacklight;
|
||||
bool m_bShowObject;
|
||||
bool m_bPrecacheMaterial;
|
||||
bool m_bDrawWireFrame;
|
||||
bool m_bShowNormals;
|
||||
bool m_bShowPhysics;
|
||||
bool m_bShowRenderInfo;
|
||||
int m_backgroundTextureId;
|
||||
float m_tileX;
|
||||
float m_tileY;
|
||||
float m_tileSizeX;
|
||||
float m_tileSizeY;
|
||||
CameraChangeCallback m_cameraChangeCallback;
|
||||
void* m_pCameraChangeUserData;
|
||||
|
||||
protected:
|
||||
void StorePreviousContext();
|
||||
void SetCurrentContext();
|
||||
void RestorePreviousContext();
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_PREVIEWMODELCTRL_H
|
||||
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : implementation file
|
||||
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "TimeOfDaySlider.h"
|
||||
|
||||
QString TimeOfDaySlider::hoverValueText(int sliderValue) const
|
||||
{
|
||||
return QString::fromLatin1("%1:%2").arg(static_cast<int>(sliderValue / 60)).arg(sliderValue % 60, 2, 10, QLatin1Char('0'));
|
||||
}
|
||||
|
||||
#include <Controls/moc_TimeOfDaySlider.cpp>
|
||||
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_TIMEOFDAYSLIDER_H
|
||||
#define CRYINCLUDE_EDITOR_TIMEOFDAYSLIDER_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzQtComponents/Components/Widgets/Slider.h>
|
||||
#endif
|
||||
|
||||
class TimeOfDaySlider
|
||||
: public AzQtComponents::SliderInt
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using AzQtComponents::SliderInt::SliderInt;
|
||||
|
||||
protected:
|
||||
QString hoverValueText(int sliderValue) const override;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_TIMEOFDAYSLIDER_H
|
||||
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "EnvironmentPanel.h"
|
||||
|
||||
// Editor
|
||||
#include "GameEngine.h"
|
||||
#include "CryEditDoc.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <ui_EnvironmentPanel.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEnvironmentPanel dialog
|
||||
|
||||
CEnvironmentPanel::CEnvironmentPanel(QWidget* pParent /*=nullptr*/)
|
||||
: QWidget(pParent)
|
||||
, ui(new Ui::CEnvironmentPanel)
|
||||
{
|
||||
XmlNodeRef node = GetIEditor()->GetDocument()->GetEnvironmentTemplate();
|
||||
|
||||
m_onSetCallback = AZStd::bind(&CCryEditDoc::OnEnvironmentPropertyChanged, GetIEditor()->GetDocument(), AZStd::placeholders::_1);
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->m_wndProps->Setup();
|
||||
ui->m_wndProps->CreateItems(node, m_varBlock, &m_onSetCallback, true);
|
||||
ui->m_wndProps->RebuildCtrl(false);
|
||||
ui->m_wndProps->ExpandAll();
|
||||
connect(ui->APPLYBTN, &QPushButton::clicked, this, &CEnvironmentPanel::OnBnClickedApply);
|
||||
}
|
||||
|
||||
CEnvironmentPanel::~CEnvironmentPanel()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEnvironmentPanel::OnBnClickedApply()
|
||||
{
|
||||
GetIEditor()->GetGameEngine()->ReloadEnvironment();
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_ENVIRONMENTPANEL_H
|
||||
#define CRYINCLUDE_EDITOR_ENVIRONMENTPANEL_H
|
||||
|
||||
#pragma once
|
||||
// EnvironmentPanel.h : header file
|
||||
//
|
||||
|
||||
#include "Util/Variable.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEnvironmentPanel dialog
|
||||
namespace Ui {
|
||||
class CEnvironmentPanel;
|
||||
}
|
||||
|
||||
class CEnvironmentPanel
|
||||
: public QWidget
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CEnvironmentPanel(QWidget* pParent = nullptr); // standard constructor
|
||||
~CEnvironmentPanel();
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
CVarBlockPtr m_varBlock;
|
||||
|
||||
public:
|
||||
void OnBnClickedApply();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CEnvironmentPanel> ui;
|
||||
|
||||
IVariable::OnSetCallback m_onSetCallback;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_ENVIRONMENTPANEL_H
|
||||
@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CEnvironmentPanel</class>
|
||||
<widget class="QWidget" name="CEnvironmentPanel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>264</width>
|
||||
<height>259</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="ReflectedPropertyControl" name="m_wndProps" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="APPLYBTN">
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>162</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ReflectedPropertyControl</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "EdGeometry.h"
|
||||
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_GEOMETRY_EDGEOMETRY_H
|
||||
#define CRYINCLUDE_EDITOR_GEOMETRY_EDGEOMETRY_H
|
||||
#pragma once
|
||||
|
||||
struct IIndexedMesh;
|
||||
struct DisplayContext;
|
||||
struct HitContext;
|
||||
struct SSubObjSelectionModifyContext;
|
||||
class CObjectArchive;
|
||||
|
||||
// Basic supported geometry types.
|
||||
enum EEdGeometryType
|
||||
{
|
||||
GEOM_TYPE_MESH = 0, // Mesh geometry.
|
||||
GEOM_TYPE_BRUSH, // Solid brush geometry.
|
||||
GEOM_TYPE_PATCH, // Bezier patch surface geometry.
|
||||
GEOM_TYPE_NURB, // Nurbs surface geometry.
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// CEdGeometry is a base class for all supported editable geometries.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CRYEDIT_API CEdGeometry
|
||||
: public CRefCountBase
|
||||
{
|
||||
public:
|
||||
CEdGeometry() {};
|
||||
|
||||
// Query the type of the geometry mesh.
|
||||
virtual EEdGeometryType GetType() const = 0;
|
||||
|
||||
// Serialize geometry.
|
||||
virtual void Serialize(CObjectArchive& ar) = 0;
|
||||
|
||||
// Return geometry axis aligned bounding box.
|
||||
virtual void GetBounds(AABB& box) = 0;
|
||||
|
||||
// Clones Geometry, returns exact copy of the original geometry.
|
||||
virtual CEdGeometry* Clone() = 0;
|
||||
|
||||
// Access to the indexed mesh.
|
||||
// Return false if geometry can not be represented by an indexed mesh.
|
||||
virtual IIndexedMesh* GetIndexedMesh(size_t idx = 0) = 0;
|
||||
virtual IStatObj* GetIStatObj() const = 0;
|
||||
virtual void GetTM(Matrix34* pTM, size_t idx = 0) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Advanced geometry interface for SubObject selection and modification.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void SetModified(bool bModified = true) = 0;
|
||||
virtual bool IsModified() const = 0;
|
||||
virtual bool StartSubObjSelection(const Matrix34& nodeWorldTM, int elemType, int nFlags) = 0;
|
||||
virtual void EndSubObjSelection() = 0;
|
||||
|
||||
// Display geometry for sub object selection.
|
||||
virtual void Display(DisplayContext& dc) = 0;
|
||||
|
||||
// Sub geometry hit testing and selection.
|
||||
virtual bool HitTest(HitContext& hit) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void ModifySelection(SSubObjSelectionModifyContext& modCtx, bool isUndo = true) = 0;
|
||||
// Called when selection modification is accepted.
|
||||
virtual void AcceptModifySelection() = 0;
|
||||
|
||||
protected:
|
||||
~CEdGeometry() {};
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_GEOMETRY_EDGEOMETRY_H
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,194 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : Editor structure that wraps access to IStatObj
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_GEOMETRY_EDMESH_H
|
||||
#define CRYINCLUDE_EDITOR_GEOMETRY_EDMESH_H
|
||||
#pragma once
|
||||
|
||||
#include "EdGeometry.h"
|
||||
#include "Objects/SubObjSelection.h"
|
||||
#include "TriMesh.h"
|
||||
|
||||
// Flags that can be set on CEdMesh.
|
||||
enum CEdMeshFlags
|
||||
{
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// CEdMesh is a Geometry kind representing simple mesh.
|
||||
// Holds IStatObj interface from the 3D Engine.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CRYEDIT_API CEdMesh
|
||||
: public CEdGeometry
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CEdGeometry implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual EEdGeometryType GetType() const { return GEOM_TYPE_MESH; };
|
||||
virtual void Serialize(CObjectArchive& ar);
|
||||
|
||||
virtual void GetBounds(AABB& box);
|
||||
virtual CEdGeometry* Clone();
|
||||
virtual IIndexedMesh* GetIndexedMesh(size_t idx = 0);
|
||||
virtual void GetTM(Matrix34* pTM, size_t idx = 0);
|
||||
virtual void SetModified(bool bModified = true);
|
||||
virtual bool IsModified() const { return m_bModified; };
|
||||
virtual bool StartSubObjSelection(const Matrix34& nodeWorldTM, int elemType, int nFlags);
|
||||
virtual void EndSubObjSelection();
|
||||
virtual void Display(DisplayContext& dc);
|
||||
virtual bool HitTest(HitContext& hit);
|
||||
bool GetSelectionReferenceFrame(Matrix34& refFrame);
|
||||
virtual void ModifySelection(SSubObjSelectionModifyContext& modCtx, bool isUndo = true);
|
||||
virtual void AcceptModifySelection();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
~CEdMesh();
|
||||
|
||||
// Return filename of mesh.
|
||||
const QString& GetFilename() const { return m_filename; };
|
||||
void SetFilename(const QString& filename);
|
||||
|
||||
//! Reload geometry of mesh.
|
||||
void ReloadGeometry();
|
||||
void AddUser();
|
||||
void RemoveUser();
|
||||
int GetUserCount() const { return m_nUserCount; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetFlags(int nFlags) { m_nFlags = nFlags; };
|
||||
int GetFlags() { return m_nFlags; }
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Access stored IStatObj.
|
||||
IStatObj* GetIStatObj() const { return m_pStatObj; }
|
||||
|
||||
//! Returns true if filename and geomname refer to the same object as this one.
|
||||
bool IsSameObject(const char* filename);
|
||||
|
||||
//! RenderMesh.
|
||||
void Render(SRendParams& rp, const SRenderingPassInfo& passInfo);
|
||||
|
||||
//! Make new CEdMesh, if same IStatObj loaded, and CEdMesh for this IStatObj is allocated.
|
||||
//! This instance of CEdMesh will be returned.
|
||||
static CEdMesh* LoadMesh(const char* filename);
|
||||
|
||||
// Creates a new mesh not from a file.
|
||||
// Create a new StatObj and IndexedMesh.
|
||||
static CEdMesh* CreateMesh(const char* name);
|
||||
|
||||
//! Reload all geometries.
|
||||
static void ReloadAllGeometries();
|
||||
static void ReleaseAll();
|
||||
|
||||
//! Check if default object was loaded.
|
||||
bool IsDefaultObject();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Copy EdMesh data to the specified mesh.
|
||||
void CopyToMesh(CTriMesh& toMesh, int nCopyFlags);
|
||||
// Copy EdMesh data from the specified mesh.
|
||||
void CopyFromMesh(CTriMesh& fromMesh, int nCopyFlags, bool bUndo);
|
||||
|
||||
// Retrieve mesh class.
|
||||
CTriMesh* GetMesh();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void InvalidateMesh();
|
||||
void SetWorldTM(const Matrix34& worldTM);
|
||||
|
||||
// Save mesh into the file.
|
||||
// Optionally can provide pointer to the pak file where to save files into.
|
||||
void SaveToCGF(const char* sFilename, CPakFile* pPakFile = NULL, _smart_ptr<IMaterial> pMaterial = NULL);
|
||||
|
||||
// Draw debug representation of this mesh.
|
||||
void DebugDraw(const SGeometryDebugDrawInfo& info, float fExtrdueScale = 0.01f);
|
||||
|
||||
private:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CEdMesh(IStatObj* pGeom);
|
||||
CEdMesh();
|
||||
void UpdateSubObjCache();
|
||||
void UpdateIndexedMeshFromCache(bool bFast);
|
||||
void OnSelectionChange();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct SSubObjHitTestEnvironment
|
||||
{
|
||||
Vec3 vWSCameraPos;
|
||||
Vec3 vWSCameraVector;
|
||||
Vec3 vOSCameraVector;
|
||||
|
||||
bool bHitTestNearest;
|
||||
bool bHitTestSelected;
|
||||
bool bSelectOnHit;
|
||||
bool bAdd;
|
||||
bool bRemove;
|
||||
bool bSelectValue;
|
||||
bool bHighlightOnly;
|
||||
bool bIgnoreBackfacing;
|
||||
};
|
||||
struct SSubObjHitTestResult
|
||||
{
|
||||
CTriMesh::EStream stream; // To What stream of the TriMesh this result apply.
|
||||
MeshElementsArray elems; // List of hit elements.
|
||||
float minDistance; // Minimal distance to the hit.
|
||||
SSubObjHitTestResult() { minDistance = FLT_MAX; }
|
||||
};
|
||||
bool HitTestVertex(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result);
|
||||
bool HitTestEdge(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result);
|
||||
bool HitTestFace(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result);
|
||||
|
||||
// Return`s true if selection changed.
|
||||
bool SelectSubObjElements(SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result);
|
||||
bool IsHitTestResultSelected(SSubObjHitTestResult& result);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! CGF filename.
|
||||
QString m_filename;
|
||||
IStatObj* m_pStatObj;
|
||||
int m_nUserCount;
|
||||
int m_nFlags;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
typedef std::map<QString, CEdMesh*, stl::less_stricmp<QString> > MeshMap;
|
||||
static MeshMap m_meshMap;
|
||||
|
||||
// This cache is created when sub object selection is needed.
|
||||
struct SubObjCache
|
||||
{
|
||||
// Cache of data in geometry.
|
||||
// World space mesh.
|
||||
CTriMesh* pTriMesh;
|
||||
Matrix34 worldTM;
|
||||
Matrix34 invWorldTM;
|
||||
CBitArray m_tempBitArray;
|
||||
bool bNoDisplay;
|
||||
|
||||
SubObjCache()
|
||||
: pTriMesh(0)
|
||||
, bNoDisplay(false) {};
|
||||
};
|
||||
SubObjCache* m_pSubObjCache;
|
||||
bool m_bModified;
|
||||
|
||||
std::vector<IIndexedMesh*> m_tempIndexedMeshes;
|
||||
std::vector<Matrix34> m_tempMatrices;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_GEOMETRY_EDMESH_H
|
||||
@ -1,364 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : CMission class implementation.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "Mission.h"
|
||||
|
||||
// cryCommon
|
||||
#include <CryCommon/ITimeOfDay.h>
|
||||
#include <CryCommon/I3DEngine.h>
|
||||
|
||||
// Editor
|
||||
#include "CryEditDoc.h"
|
||||
#include "GameEngine.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
const char* kTimeOfDayFile = "TimeOfDay.xml";
|
||||
const char* kTimeOfDayRoot = "TimeOfDay";
|
||||
const char* kEnvironmentFile = "Environment.xml";
|
||||
const char* kEnvironmentRoot = "Environment";
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMission::CMission(CCryEditDoc* doc)
|
||||
{
|
||||
m_doc = doc;
|
||||
m_objects = XmlHelpers::CreateXmlNode("Objects");
|
||||
m_layers = XmlHelpers::CreateXmlNode("ObjectLayers");
|
||||
//m_exportData = XmlNodeRef( "ExportData" );
|
||||
m_timeOfDay = XmlHelpers::CreateXmlNode("TimeOfDay");
|
||||
m_environment = XmlHelpers::CreateXmlNode("Environment");
|
||||
CXmlTemplate::SetValues(m_doc->GetEnvironmentTemplate(), m_environment);
|
||||
|
||||
m_time = 12; // 12 PM by default.
|
||||
|
||||
m_numCGFObjects = 0;
|
||||
|
||||
m_reentrancyProtector = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMission::~CMission()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMission* CMission::Clone()
|
||||
{
|
||||
CMission* m = new CMission(m_doc);
|
||||
m->SetName(m_name);
|
||||
m->SetDescription(m_description);
|
||||
m->m_objects = m_objects->clone();
|
||||
m->m_layers = m_layers->clone();
|
||||
m->m_environment = m_environment->clone();
|
||||
m->m_time = m_time;
|
||||
return m;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::Serialize(CXmlArchive& ar, bool bParts)
|
||||
{
|
||||
if (ar.bLoading)
|
||||
{
|
||||
// Load.
|
||||
ar.root->getAttr("Name", m_name);
|
||||
ar.root->getAttr("Description", m_description);
|
||||
|
||||
XmlNodeRef objects = ar.root->findChild("Objects");
|
||||
if (objects)
|
||||
{
|
||||
m_objects = objects;
|
||||
}
|
||||
|
||||
XmlNodeRef layers = ar.root->findChild("ObjectLayers");
|
||||
if (layers)
|
||||
{
|
||||
m_layers = layers;
|
||||
}
|
||||
|
||||
SerializeTimeOfDay(ar);
|
||||
|
||||
m_Animations = ar.root->findChild("MovieData");
|
||||
|
||||
SerializeEnvironment(ar);
|
||||
}
|
||||
else
|
||||
{
|
||||
ar.root->setAttr("Name", m_name.toUtf8().data());
|
||||
ar.root->setAttr("Description", m_description.toUtf8().data());
|
||||
|
||||
QString timeStr;
|
||||
int nHour = floor(m_time);
|
||||
int nMins = (m_time - floor(m_time)) * 60.0f;
|
||||
timeStr = QStringLiteral("%1:%2").arg(nHour, 2, 10, QLatin1Char('0')).arg(nMins, 2, 10, QLatin1Char('0'));
|
||||
ar.root->setAttr("MissionTime", timeStr.toUtf8().data());
|
||||
|
||||
// Saving.
|
||||
XmlNodeRef layers = m_layers->clone();
|
||||
layers->setTag("ObjectLayers");
|
||||
ar.root->addChild(layers);
|
||||
|
||||
///XmlNodeRef objects = m_objects->clone();
|
||||
m_objects->setTag("Objects");
|
||||
ar.root->addChild(m_objects);
|
||||
|
||||
if (bParts)
|
||||
{
|
||||
SerializeTimeOfDay(ar);
|
||||
SerializeEnvironment(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::Export(XmlNodeRef& root, XmlNodeRef& objectsNode)
|
||||
{
|
||||
// Also save exported objects data.
|
||||
root->setAttr("Name", m_name.toUtf8().data());
|
||||
root->setAttr("Description", m_description.toUtf8().data());
|
||||
|
||||
QString timeStr;
|
||||
int nHour = floor(m_time);
|
||||
int nMins = (m_time - floor(m_time)) * 60.0f;
|
||||
timeStr = QStringLiteral("%1:%2").arg(nHour, 2, 10, QLatin1Char('0')).arg(nMins, 2, 10, QLatin1Char('0'));
|
||||
root->setAttr("Time", timeStr.toUtf8().data());
|
||||
|
||||
// Saving.
|
||||
//XmlNodeRef objects = m_exportData->clone();
|
||||
//objects->setTag( "Objects" );
|
||||
//root->addChild( objects );
|
||||
|
||||
XmlNodeRef envNode = m_environment->clone();
|
||||
root->addChild(envNode);
|
||||
|
||||
m_timeOfDay->setAttr("Time", m_time);
|
||||
root->addChild(m_timeOfDay);
|
||||
|
||||
IObjectManager* pObjMan = GetIEditor()->GetObjectManager();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Serialize objects.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString path = QDir::toNativeSeparators(QFileInfo(m_doc->GetLevelPathName()).absolutePath());
|
||||
if (!path.endsWith(QDir::separator()))
|
||||
path += QDir::separator();
|
||||
|
||||
objectsNode = root->newChild("Objects");
|
||||
pObjMan->Export(path, objectsNode, true); // Export shared.
|
||||
pObjMan->Export(path, objectsNode, false); // Export not shared.
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SyncContent(bool bRetrieve, bool bIgnoreObjects, [[maybe_unused]] bool bSkipLoadingAI /* = false */)
|
||||
{
|
||||
// The function may take a longer time when executing objMan->Serialize, which uses CWaitProgress internally
|
||||
// Adding a sync flag to prevent the function from being re-entered after the data is modified by OnEnvironmentChange
|
||||
if (m_reentrancyProtector)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_reentrancyProtector = true;
|
||||
|
||||
// Save data from current Document to Mission.
|
||||
IObjectManager* objMan = GetIEditor()->GetObjectManager();
|
||||
if (bRetrieve)
|
||||
{
|
||||
// Activating this mission.
|
||||
CGameEngine* gameEngine = GetIEditor()->GetGameEngine();
|
||||
|
||||
if (!bIgnoreObjects)
|
||||
{
|
||||
// Retrieve data from Mission and put to document.
|
||||
XmlNodeRef root = XmlHelpers::CreateXmlNode("Root");
|
||||
root->addChild(m_objects);
|
||||
root->addChild(m_layers);
|
||||
objMan->Serialize(root, true, SERIALIZE_ONLY_NOTSHARED);
|
||||
}
|
||||
|
||||
m_doc->GetFogTemplate() = m_environment;
|
||||
|
||||
CXmlTemplate::GetValues(m_doc->GetEnvironmentTemplate(), m_environment);
|
||||
|
||||
gameEngine->ReloadEnvironment();
|
||||
|
||||
objMan->SendEvent(EVENT_MISSION_CHANGE);
|
||||
m_doc->ChangeMission();
|
||||
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
m_numCGFObjects = GetIEditor()->Get3DEngine()->GetLoadedObjectCount();
|
||||
|
||||
// Load time of day.
|
||||
GetIEditor()->Get3DEngine()->GetTimeOfDay()->Serialize(m_timeOfDay, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save time of day.
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
m_timeOfDay = XmlHelpers::CreateXmlNode("TimeOfDay");
|
||||
GetIEditor()->Get3DEngine()->GetTimeOfDay()->Serialize(m_timeOfDay, false);
|
||||
}
|
||||
|
||||
if (!bIgnoreObjects)
|
||||
{
|
||||
XmlNodeRef root = XmlHelpers::CreateXmlNode("Root");
|
||||
objMan->Serialize(root, false, SERIALIZE_ONLY_NOTSHARED);
|
||||
m_objects = root->findChild("Objects");
|
||||
XmlNodeRef layers = root->findChild("ObjectLayers");
|
||||
if (layers)
|
||||
{
|
||||
m_layers = layers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_reentrancyProtector = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::OnEnvironmentChange()
|
||||
{
|
||||
// Only execute the reload function if there is no ongoing SyncContent.
|
||||
if (m_reentrancyProtector)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_reentrancyProtector = true;
|
||||
m_environment = XmlHelpers::CreateXmlNode("Environment");
|
||||
CXmlTemplate::SetValues(m_doc->GetEnvironmentTemplate(), m_environment);
|
||||
m_reentrancyProtector = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::AddObjectsNode(XmlNodeRef& node)
|
||||
{
|
||||
for (int i = 0; i < node->getChildCount(); i++)
|
||||
{
|
||||
m_objects->addChild(node->getChild(i)->clone());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SetLayersNode(XmlNodeRef& node)
|
||||
{
|
||||
m_layers = node->clone();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SaveParts()
|
||||
{
|
||||
// Save Time of Day
|
||||
{
|
||||
CTempFileHelper helper((GetIEditor()->GetLevelDataFolder() + kTimeOfDayFile).toUtf8().data());
|
||||
|
||||
m_timeOfDay->saveToFile(helper.GetTempFilePath().toUtf8().data());
|
||||
|
||||
if (!helper.UpdateFile(false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save Environment
|
||||
{
|
||||
CTempFileHelper helper((GetIEditor()->GetLevelDataFolder() + kEnvironmentFile).toUtf8().data());
|
||||
|
||||
XmlNodeRef root = m_environment->clone();
|
||||
root->setTag(kEnvironmentRoot);
|
||||
root->saveToFile(helper.GetTempFilePath().toUtf8().data());
|
||||
|
||||
if (!helper.UpdateFile(false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::LoadParts()
|
||||
{
|
||||
// Load Time of Day
|
||||
{
|
||||
QString filename = GetIEditor()->GetLevelDataFolder() + kTimeOfDayFile;
|
||||
XmlNodeRef root = XmlHelpers::LoadXmlFromFile(filename.toUtf8().data());
|
||||
if (root && !_stricmp(root->getTag(), kTimeOfDayRoot))
|
||||
{
|
||||
m_timeOfDay = root;
|
||||
m_timeOfDay->getAttr("Time", m_time);
|
||||
}
|
||||
}
|
||||
|
||||
// Load Environment
|
||||
{
|
||||
QString filename = GetIEditor()->GetLevelDataFolder() + kEnvironmentFile;
|
||||
XmlNodeRef root = XmlHelpers::LoadXmlFromFile(filename.toUtf8().data());
|
||||
if (root && !_stricmp(root->getTag(), kEnvironmentRoot))
|
||||
{
|
||||
m_environment = root;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SerializeTimeOfDay(CXmlArchive& ar)
|
||||
{
|
||||
if (ar.bLoading)
|
||||
{
|
||||
XmlNodeRef todNode = ar.root->findChild("TimeOfDay");
|
||||
if (todNode)
|
||||
{
|
||||
m_timeOfDay = todNode;
|
||||
todNode->getAttr("Time", m_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timeOfDay = XmlHelpers::CreateXmlNode("TimeOfDay");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timeOfDay->setAttr("Time", m_time);
|
||||
ar.root->addChild(m_timeOfDay);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SerializeEnvironment(CXmlArchive& ar)
|
||||
{
|
||||
if (ar.bLoading)
|
||||
{
|
||||
XmlNodeRef env = ar.root->findChild("Environment");
|
||||
if (env)
|
||||
{
|
||||
m_environment = env;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlNodeRef env = m_environment->clone();
|
||||
env->setTag("Environment");
|
||||
ar.root->addChild(env);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : Mission class definition.
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
/*!
|
||||
CMission represent single Game Mission on same map.
|
||||
Multiple Missions share same map, and stored in one .cry or .ly file.
|
||||
|
||||
*/
|
||||
class CMission
|
||||
{
|
||||
public:
|
||||
//! Ctor of mission.
|
||||
CMission(CCryEditDoc* doc);
|
||||
//! Dtor of mission.
|
||||
virtual ~CMission();
|
||||
|
||||
void SetName(const QString& name) { m_name = name; }
|
||||
const QString& GetName() const { return m_name; }
|
||||
|
||||
void SetDescription(const QString& dsc) { m_description = dsc; }
|
||||
const QString& GetDescription() const { return m_description; }
|
||||
|
||||
XmlNodeRef GetEnvironment() { return m_environment; };
|
||||
|
||||
void SetTime(float time) { m_time = time; };
|
||||
float GetTime() const { return m_time; };
|
||||
|
||||
//! Called when this mission must be synchonized with current data in Document.
|
||||
//! if bRetrieve is true, data is retrieved from Mission to global structures.
|
||||
void SyncContent(bool bRetrieve, bool bIgnoreObjects, bool bSkipLoadingAI = false);
|
||||
|
||||
//! Create clone of this mission.
|
||||
CMission* Clone();
|
||||
|
||||
//! Serialize mission.
|
||||
void Serialize(CXmlArchive& ar, bool bParts = true);
|
||||
|
||||
//! Serialize time of day
|
||||
void SerializeTimeOfDay(CXmlArchive& ar);
|
||||
|
||||
//! Serialize environment
|
||||
void SerializeEnvironment(CXmlArchive& ar);
|
||||
|
||||
//! Save some elements of mission to separate files
|
||||
void SaveParts();
|
||||
|
||||
//! Load some elements of mission from separate files
|
||||
void LoadParts();
|
||||
|
||||
//! Export mission to game.
|
||||
void Export(XmlNodeRef& root, XmlNodeRef& objectsNode);
|
||||
|
||||
//! Add shared objects to mission objects.
|
||||
void AddObjectsNode(XmlNodeRef& node);
|
||||
void SetLayersNode(XmlNodeRef& node);
|
||||
|
||||
void OnEnvironmentChange();
|
||||
int GetNumCGFObjects() const { return m_numCGFObjects; };
|
||||
|
||||
private:
|
||||
//! Document owner of this mission.
|
||||
CCryEditDoc* m_doc;
|
||||
|
||||
QString m_name;
|
||||
QString m_description;
|
||||
|
||||
//! Mission time;
|
||||
float m_time;
|
||||
|
||||
//! Root node of objects defined only in this mission.
|
||||
XmlNodeRef m_objects;
|
||||
|
||||
//! Object layers.
|
||||
XmlNodeRef m_layers;
|
||||
|
||||
//! Exported data of this mission.
|
||||
XmlNodeRef m_exportData;
|
||||
|
||||
//! Environment settings of this mission.
|
||||
XmlNodeRef m_environment;
|
||||
|
||||
XmlNodeRef m_Animations; // backward compatibility.
|
||||
|
||||
XmlNodeRef m_timeOfDay;
|
||||
|
||||
int m_numCGFObjects;
|
||||
|
||||
bool m_reentrancyProtector;
|
||||
};
|
||||
|
||||
@ -1,961 +0,0 @@
|
||||
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "ModelViewport.h"
|
||||
|
||||
// Qt
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/IViewSystem.h>
|
||||
|
||||
#include "CryPhysicsDeprecation.h"
|
||||
|
||||
|
||||
// Editor
|
||||
#include "ThumbnailGenerator.h" // for CThumbnailGenerator
|
||||
#include "FileTypeUtils.h" // for IsPreviewableFileType
|
||||
#include "ErrorRecorder.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint32 g_ypos = 0;
|
||||
|
||||
#define SKYBOX_NAME "InfoRedGal"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CModelViewport
|
||||
|
||||
CModelViewport::CModelViewport(const char* settingsPath, QWidget* parent)
|
||||
: CRenderViewport(tr("Model View"), parent)
|
||||
{
|
||||
m_settingsPath = QString::fromLatin1(settingsPath);
|
||||
|
||||
m_bPaused = false;
|
||||
|
||||
m_Camera.SetFrustum(800, 600, 3.14f / 4.0f, 0.02f, 10000);
|
||||
|
||||
m_bInRotateMode = false;
|
||||
m_bInMoveMode = false;
|
||||
|
||||
m_object = 0;
|
||||
|
||||
|
||||
m_weaponModel = 0;
|
||||
|
||||
m_camRadius = 10;
|
||||
|
||||
m_moveSpeed = 0.1f;
|
||||
m_LightRotationRadian = 0.0f;
|
||||
|
||||
m_weaponIK = false;
|
||||
|
||||
m_pRESky = 0;
|
||||
m_pSkyboxName = 0;
|
||||
m_pSkyBoxShader = NULL;
|
||||
|
||||
m_attachBone = QStringLiteral("weapon_bone");
|
||||
|
||||
// Init variable.
|
||||
mv_objectAmbientColor = Vec3(0.25f, 0.25f, 0.25f);
|
||||
mv_backgroundColor = Vec3(0.25f, 0.25f, 0.25f);
|
||||
|
||||
mv_lightDiffuseColor = Vec3(0.70f, 0.70f, 0.70f);
|
||||
mv_lightMultiplier = 3.0f;
|
||||
mv_lightOrbit = 15.0f;
|
||||
mv_lightRadius = 400.0f;
|
||||
mv_lightSpecMultiplier = 1.0f;
|
||||
|
||||
mv_showPhysics = false;
|
||||
|
||||
m_GridOrigin = Vec3(ZERO);
|
||||
m_arrAnimatedCharacterPath.resize(0x200, ZERO);
|
||||
m_arrSmoothEntityPath.resize(0x200, ZERO);
|
||||
|
||||
m_arrRunStrafeSmoothing.resize(0x100);
|
||||
SetPlayerPos();
|
||||
|
||||
// cache all the variable callbacks, must match order of enum defined in header
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CModelViewport::OnCharPhysics, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CModelViewport::OnLightColor, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CModelViewport::OnLightMultiplier, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CModelViewport::OnShowShaders, this, AZStd::placeholders::_1));
|
||||
|
||||
//--------------------------------------------------
|
||||
// Register variables.
|
||||
//--------------------------------------------------
|
||||
m_vars.AddVariable(mv_showPhysics, "Display Physics");
|
||||
m_vars.AddVariable(mv_useCharPhysics, "Use Character Physics", &m_onSetCallbacksCache[VariableCallbackIndex::OnCharPhysics]);
|
||||
mv_useCharPhysics = true;
|
||||
m_vars.AddVariable(mv_showGrid, "ShowGrid");
|
||||
mv_showGrid = true;
|
||||
m_vars.AddVariable(mv_showBase, "ShowBase");
|
||||
mv_showBase = false;
|
||||
m_vars.AddVariable(mv_showLocator, "ShowLocator");
|
||||
mv_showLocator = 0;
|
||||
m_vars.AddVariable(mv_InPlaceMovement, "InPlaceMovement");
|
||||
mv_InPlaceMovement = false;
|
||||
m_vars.AddVariable(mv_StrafingControl, "StrafingControl");
|
||||
mv_StrafingControl = false;
|
||||
|
||||
m_vars.AddVariable(mv_lighting, "Lighting");
|
||||
mv_lighting = true;
|
||||
m_vars.AddVariable(mv_animateLights, "AnimLights");
|
||||
|
||||
m_vars.AddVariable(mv_backgroundColor, "BackgroundColor", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightColor], IVariable::DT_COLOR);
|
||||
m_vars.AddVariable(mv_objectAmbientColor, "ObjectAmbient", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightColor], IVariable::DT_COLOR);
|
||||
|
||||
m_vars.AddVariable(mv_lightDiffuseColor, "LightDiffuse", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightColor], IVariable::DT_COLOR);
|
||||
m_vars.AddVariable(mv_lightMultiplier, "Light Multiplier", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightMultiplier], IVariable::DT_SIMPLE);
|
||||
m_vars.AddVariable(mv_lightSpecMultiplier, "Light Specular Multiplier", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightMultiplier], IVariable::DT_SIMPLE);
|
||||
m_vars.AddVariable(mv_lightRadius, "Light Radius", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightMultiplier], IVariable::DT_SIMPLE);
|
||||
m_vars.AddVariable(mv_lightOrbit, "Light Orbit", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightMultiplier], IVariable::DT_SIMPLE);
|
||||
|
||||
m_vars.AddVariable(mv_showWireframe1, "ShowWireframe1");
|
||||
m_vars.AddVariable(mv_showWireframe2, "ShowWireframe2");
|
||||
m_vars.AddVariable(mv_showTangents, "ShowTangents");
|
||||
m_vars.AddVariable(mv_showBinormals, "ShowBinormals");
|
||||
m_vars.AddVariable(mv_showNormals, "ShowNormals");
|
||||
|
||||
m_vars.AddVariable(mv_showSkeleton, "ShowSkeleton");
|
||||
m_vars.AddVariable(mv_showJointNames, "ShowJointNames");
|
||||
m_vars.AddVariable(mv_showJointsValues, "ShowJointsValues");
|
||||
m_vars.AddVariable(mv_showStartLocation, "ShowInvStartLocation");
|
||||
m_vars.AddVariable(mv_showMotionParam, "ShowMotionParam");
|
||||
m_vars.AddVariable(mv_printDebugText, "PrintDebugText");
|
||||
|
||||
m_vars.AddVariable(mv_UniformScaling, "UniformScaling");
|
||||
mv_UniformScaling = 1.0f;
|
||||
mv_UniformScaling.SetLimits(0.01f, 2.0f);
|
||||
m_vars.AddVariable(mv_forceLODNum, "ForceLODNum");
|
||||
mv_forceLODNum = 0;
|
||||
mv_forceLODNum.SetLimits(0, 10);
|
||||
m_vars.AddVariable(mv_showShaders, "ShowShaders", &m_onSetCallbacksCache[VariableCallbackIndex::OnShowShaders]);
|
||||
m_vars.AddVariable(mv_AttachCamera, "AttachCamera");
|
||||
|
||||
m_vars.AddVariable(mv_fov, "FOV");
|
||||
mv_fov = 60;
|
||||
mv_fov.SetLimits(1, 120);
|
||||
|
||||
RestoreDebugOptions();
|
||||
|
||||
m_camRadius = 10;
|
||||
|
||||
//YPR_Angle = Ang3(0,-1.0f,0);
|
||||
//SetViewTM( Matrix34(CCamera::CreateOrientationYPR(YPR_Angle), Vec3(0,-m_camRadius,0)) );
|
||||
Vec3 camPos = Vec3(10, 10, 10);
|
||||
Matrix34 tm = Matrix33::CreateRotationVDir((Vec3(0, 0, 0) - camPos).GetNormalized());
|
||||
tm.SetTranslation(camPos);
|
||||
SetViewTM(tm);
|
||||
|
||||
|
||||
m_AABB.Reset();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::SaveDebugOptions() const
|
||||
{
|
||||
QSettings settings;
|
||||
for (auto g : m_settingsPath.split('\\'))
|
||||
settings.beginGroup(g);
|
||||
|
||||
CVarBlock* vb = GetVarObject()->GetVarBlock();
|
||||
int32 vbCount = vb->GetNumVariables();
|
||||
|
||||
settings.setValue("iDebugOptionCount", vbCount);
|
||||
|
||||
char keyType[64], keyValue[64];
|
||||
for (int32 i = 0; i < vbCount; ++i)
|
||||
{
|
||||
IVariable* var = vb->GetVariable(i);
|
||||
IVariable::EType vType = var->GetType();
|
||||
sprintf_s(keyType, "DebugOption_%s_type", var->GetName().toUtf8().data());
|
||||
sprintf_s(keyValue, "DebugOption_%s_value", var->GetName().toUtf8().data());
|
||||
switch (vType)
|
||||
{
|
||||
case IVariable::UNKNOWN:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case IVariable::INT:
|
||||
{
|
||||
int32 value = 0;
|
||||
var->Get(value);
|
||||
settings.setValue(keyType, IVariable::INT);
|
||||
settings.setValue(keyValue, value);
|
||||
|
||||
break;
|
||||
}
|
||||
case IVariable::BOOL:
|
||||
{
|
||||
bool value = 0;
|
||||
var->Get(value);
|
||||
settings.setValue(keyType, IVariable::BOOL);
|
||||
settings.setValue(keyValue, value);
|
||||
break;
|
||||
}
|
||||
case IVariable::FLOAT:
|
||||
{
|
||||
f32 value = 0;
|
||||
var->Get(value);
|
||||
settings.setValue(keyType, IVariable::FLOAT);
|
||||
settings.setValue(keyValue, value);
|
||||
break;
|
||||
}
|
||||
case IVariable::VECTOR:
|
||||
{
|
||||
Vec3 value;
|
||||
var->Get(value);
|
||||
f32 valueArray[3];
|
||||
valueArray[0] = value.x;
|
||||
valueArray[1] = value.y;
|
||||
valueArray[2] = value.z;
|
||||
settings.setValue(keyType, IVariable::VECTOR);
|
||||
settings.setValue(keyValue, QByteArray(reinterpret_cast<const char*>(&value), 3 * sizeof(f32)));
|
||||
|
||||
break;
|
||||
}
|
||||
case IVariable::QUAT:
|
||||
{
|
||||
Quat value;
|
||||
var->Get(value);
|
||||
f32 valueArray[4];
|
||||
valueArray[0] = value.w;
|
||||
valueArray[1] = value.v.x;
|
||||
valueArray[2] = value.v.y;
|
||||
valueArray[3] = value.v.z;
|
||||
|
||||
settings.setValue(keyType, IVariable::QUAT);
|
||||
settings.setValue(keyValue, QByteArray(reinterpret_cast<const char*>(&value), 4 * sizeof(f32)));
|
||||
|
||||
break;
|
||||
}
|
||||
case IVariable::STRING:
|
||||
{
|
||||
QString value;
|
||||
var->Get(value);
|
||||
settings.setValue(keyType, IVariable::STRING);
|
||||
settings.setValue(keyValue, value);
|
||||
|
||||
break;
|
||||
}
|
||||
case IVariable::ARRAY:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::RestoreDebugOptions()
|
||||
{
|
||||
QSettings settings;
|
||||
for (auto g : m_settingsPath.split('\\'))
|
||||
settings.beginGroup(g);
|
||||
|
||||
QString strRead = "";
|
||||
int32 iRead = 0;
|
||||
BOOL bRead = FALSE;
|
||||
f32 fRead = .0f;
|
||||
QByteArray pbtData;
|
||||
|
||||
CVarBlock* vb = m_vars.GetVarBlock();
|
||||
int32 vbCount = vb->GetNumVariables();
|
||||
|
||||
char keyType[64], keyValue[64];
|
||||
for (int32 i = 0; i < vbCount; ++i)
|
||||
{
|
||||
IVariable* var = vb->GetVariable(i);
|
||||
sprintf_s(keyType, "DebugOption_%s_type", var->GetName().toUtf8().data());
|
||||
|
||||
int32 iType = settings.value(keyType, 0).toInt();
|
||||
|
||||
sprintf_s(keyValue, "DebugOption_%s_value", var->GetName().toUtf8().data());
|
||||
switch (iType)
|
||||
{
|
||||
case IVariable::UNKNOWN:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case IVariable::INT:
|
||||
{
|
||||
iRead = settings.value(keyValue, 0).toInt();
|
||||
var->Set(iRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::BOOL:
|
||||
{
|
||||
bRead = settings.value(keyValue, FALSE).toBool();
|
||||
var->Set(bRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::FLOAT:
|
||||
{
|
||||
fRead = settings.value(keyValue).toDouble();
|
||||
var->Set(fRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::VECTOR:
|
||||
{
|
||||
pbtData = settings.value(keyValue).toByteArray();
|
||||
assert(pbtData.count() == 3 * sizeof(f32));
|
||||
f32* pfRead = reinterpret_cast<f32*>(pbtData.data());
|
||||
|
||||
Vec3 vecRead(pfRead[0], pfRead[1], pfRead[2]);
|
||||
var->Set(vecRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::QUAT:
|
||||
{
|
||||
pbtData = settings.value(keyValue).toByteArray();
|
||||
assert(pbtData.count() == 4 * sizeof(f32));
|
||||
f32* pfRead = reinterpret_cast<f32*>(pbtData.data());
|
||||
|
||||
Quat valueRead(pfRead[0], pfRead[1], pfRead[2], pfRead[3]);
|
||||
var->Set(valueRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::STRING:
|
||||
{
|
||||
strRead = settings.value(keyValue, "").toString();
|
||||
var->Set(strRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::ARRAY:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CModelViewport::~CModelViewport()
|
||||
{
|
||||
OnDestroy();
|
||||
ReleaseObject();
|
||||
|
||||
GetIEditor()->FlushUndo();
|
||||
|
||||
SaveDebugOptions();
|
||||
|
||||
// helper offset??
|
||||
CRY_PHYSICS_REPLACEMENT_ASSERT();
|
||||
GetIEditor()->SetConsoleVar("ca_UsePhysics", 1);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CModelViewport message handlers
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::ReleaseObject()
|
||||
{
|
||||
if (m_object)
|
||||
{
|
||||
m_object->Release();
|
||||
m_object = NULL;
|
||||
}
|
||||
|
||||
if (m_weaponModel)
|
||||
{
|
||||
m_weaponModel->Release();
|
||||
m_weaponModel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::LoadObject(const QString& fileName, [[maybe_unused]] float scale)
|
||||
{
|
||||
m_bPaused = false;
|
||||
|
||||
// Load object.
|
||||
QString file = Path::MakeGamePath(fileName);
|
||||
|
||||
bool reload = false;
|
||||
if (m_loadedFile == file)
|
||||
{
|
||||
reload = true;
|
||||
}
|
||||
m_loadedFile = file;
|
||||
|
||||
SetName(tr("Model View - %1").arg(file));
|
||||
|
||||
ReleaseObject();
|
||||
|
||||
// Enables display of warning after model have been loaded.
|
||||
CErrorsRecorder errRecorder;
|
||||
|
||||
if (IsPreviewableFileType(file.toUtf8().data()))
|
||||
{
|
||||
const QString fileExt = QFileInfo(file).completeSuffix();
|
||||
// Try Load character.
|
||||
const bool isSKEL = (0 == fileExt.compare(CRY_SKEL_FILE_EXT, Qt::CaseInsensitive));
|
||||
const bool isSKIN = (0 == fileExt.compare(CRY_SKIN_FILE_EXT, Qt::CaseInsensitive));
|
||||
const bool isCGA = (0 == fileExt.compare(CRY_ANIM_GEOMETRY_FILE_EXT, Qt::CaseInsensitive));
|
||||
const bool isCDF = (0 == fileExt.compare(CRY_CHARACTER_DEFINITION_FILE_EXT, Qt::CaseInsensitive));
|
||||
if (isSKEL || isSKIN || isCGA || isCDF)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadStaticObject(file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, tr("Preview Error"), tr("Preview of this file type not supported."));
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
if (!reload)
|
||||
{
|
||||
Vec3 v = m_AABB.max - m_AABB.min;
|
||||
float radius = v.GetLength() / 2.0f;
|
||||
m_camRadius = radius * 2;
|
||||
}
|
||||
|
||||
if (GetIEditor()->IsInPreviewMode())
|
||||
{
|
||||
Physicalize();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::LoadStaticObject(const QString& file)
|
||||
{
|
||||
if (m_object)
|
||||
{
|
||||
m_object->Release();
|
||||
}
|
||||
|
||||
// Load Static object.
|
||||
m_object = m_engine->LoadStatObjUnsafeManualRef(file.toUtf8().data(), 0, 0, false);
|
||||
|
||||
if (!m_object)
|
||||
{
|
||||
CLogFile::WriteLine("Loading of object failed.");
|
||||
return;
|
||||
}
|
||||
m_object->AddRef();
|
||||
|
||||
// Generate thumbnail for this cgf.
|
||||
CThumbnailGenerator thumbGen;
|
||||
thumbGen.GenerateForFile(file);
|
||||
|
||||
m_AABB.min = m_object->GetBoxMin();
|
||||
m_AABB.max = m_object->GetBoxMax();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnRender()
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
const QRect rc = contentsRect();
|
||||
ProcessKeys();
|
||||
if (m_renderer)
|
||||
{
|
||||
PreWidgetRendering();
|
||||
|
||||
m_Camera.SetFrustum(m_Camera.GetViewSurfaceX(), m_Camera.GetViewSurfaceZ(), m_Camera.GetFov(), 0.02f, 10000, m_Camera.GetPixelAspectRatio());
|
||||
const int w = rc.width();
|
||||
const int h = rc.height();
|
||||
m_Camera.SetFrustum(w, h, DEG2RAD(mv_fov), 0.0101f, 10000.0f);
|
||||
|
||||
if (GetIEditor()->IsInPreviewMode())
|
||||
{
|
||||
GetISystem()->SetViewCamera(m_Camera);
|
||||
}
|
||||
|
||||
Vec3 clearColor = mv_backgroundColor;
|
||||
m_renderer->SetClearColor(clearColor);
|
||||
m_renderer->SetCamera(m_Camera);
|
||||
|
||||
auto colorf = ColorF(clearColor, 1.0f);
|
||||
m_renderer->ClearTargetsImmediately(FRT_CLEAR | FRT_CLEAR_IMMEDIATE, colorf);
|
||||
m_renderer->ResetToDefault();
|
||||
|
||||
SRenderingPassInfo passInfo = SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_Camera, SRenderingPassInfo::DEFAULT_FLAGS, true);
|
||||
|
||||
{
|
||||
CScopedWireFrameMode scopedWireFrame(m_renderer, mv_showWireframe1 ? R_WIREFRAME_MODE : R_SOLID_MODE);
|
||||
DrawModel(passInfo);
|
||||
}
|
||||
|
||||
PostWidgetRendering();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::DrawSkyBox(const SRenderingPassInfo& passInfo)
|
||||
{
|
||||
CRenderObject* pObj = m_renderer->EF_GetObject_Temp(passInfo.ThreadID());
|
||||
pObj->m_II.m_Matrix.SetTranslationMat(GetViewTM().GetTranslation());
|
||||
|
||||
if (m_pSkyboxName)
|
||||
{
|
||||
SShaderItem skyBoxShaderItem(m_pSkyBoxShader);
|
||||
m_renderer->EF_AddEf(m_pRESky, skyBoxShaderItem, pObj, passInfo, EFSLIST_GENERAL, 1, SRendItemSorter::CreateRendItemSorter(passInfo));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimBack()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimFastBack()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimFastForward()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimFront()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimPlay()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
|
||||
CRenderViewport::mouseDoubleClickEvent(event);
|
||||
if (event->button() != Qt::LeftButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Matrix34 tm;
|
||||
tm.SetIdentity();
|
||||
SetViewTM(tm);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnLightColor([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnShowNormals([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
bool enable = mv_showNormals;
|
||||
GetIEditor()->SetConsoleVar("r_ShowNormals", (enable) ? 1 : 0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnShowTangents([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
bool enable = mv_showTangents;
|
||||
GetIEditor()->SetConsoleVar("r_ShowTangents", (enable) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnCharPhysics([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
bool enable = mv_useCharPhysics;
|
||||
GetIEditor()->SetConsoleVar("ca_UsePhysics", enable);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnShowShaders([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
bool bEnable = mv_showShaders;
|
||||
GetIEditor()->SetConsoleVar("r_ProfileShaders", bEnable);
|
||||
}
|
||||
|
||||
void CModelViewport::OnDestroy()
|
||||
{
|
||||
ReleaseObject();
|
||||
if (m_pRESky)
|
||||
{
|
||||
m_pRESky->Release(false);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnActivate()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnDeactivate()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::Update()
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
CRenderViewport::Update();
|
||||
|
||||
DrawInfo();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::DrawInfo() const
|
||||
{
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
ICVar* pDisplayInfo = gEnv->pConsole->GetCVar("r_DisplayInfo");
|
||||
if (pDisplayInfo && pDisplayInfo->GetIVal() != 0)
|
||||
{
|
||||
const float fps = gEnv->pTimer->GetFrameRate();
|
||||
const float x = (float)gEnv->pRenderer->GetWidth() - 5.0f;
|
||||
|
||||
gEnv->p3DEngine->DrawTextRightAligned(x, 1, "FPS: %.2f", fps);
|
||||
|
||||
int nPolygons, nShadowVolPolys;
|
||||
gEnv->pRenderer->GetPolyCount(nPolygons, nShadowVolPolys);
|
||||
int nDrawCalls = gEnv->pRenderer->GetCurrentNumberOfDrawCalls();
|
||||
gEnv->p3DEngine->DrawTextRightAligned(x, 20, "Tris:%2d,%03d - DP:%d", nPolygons / 1000, nPolygons % 1000, nDrawCalls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CModelViewport::CanDrop([[maybe_unused]] const QPoint& point, IDataBaseItem* pItem)
|
||||
{
|
||||
if (!pItem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::Drop([[maybe_unused]] const QPoint& point, [[maybe_unused]] IDataBaseItem* pItem)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::Physicalize()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::RePhysicalize()
|
||||
{
|
||||
Physicalize();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::SetPaused(bool bPaused)
|
||||
{
|
||||
//return;
|
||||
if (m_bPaused != bPaused)
|
||||
{
|
||||
m_bPaused = bPaused;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::DrawModel(const SRenderingPassInfo& passInfo)
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
m_vCamPos = GetCamera().GetPosition();
|
||||
const QRect rc = contentsRect();
|
||||
//GetISystem()->SetViewCamera( m_Camera );
|
||||
IRenderAuxGeom* pAuxGeom = m_renderer->GetIRenderAuxGeom();
|
||||
m_renderer->BeginSpawningGeneratingRendItemJobs(passInfo.ThreadID());
|
||||
m_renderer->BeginSpawningShadowGeneratingRendItemJobs(passInfo.ThreadID());
|
||||
m_renderer->EF_ClearSkinningDataPool();
|
||||
m_renderer->EF_StartEf(passInfo);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Draw lights.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (mv_lighting == true)
|
||||
{
|
||||
pAuxGeom->DrawSphere(m_VPLight.m_Origin, 0.2f, ColorB(255, 255, 0, 255));
|
||||
}
|
||||
|
||||
gEnv->pConsole->GetCVar("ca_DrawWireframe")->Set(mv_showWireframe2);
|
||||
gEnv->pConsole->GetCVar("ca_DrawTangents")->Set(mv_showTangents);
|
||||
gEnv->pConsole->GetCVar("ca_DrawBinormals")->Set(mv_showBinormals);
|
||||
gEnv->pConsole->GetCVar("ca_DrawNormals")->Set(mv_showNormals);
|
||||
|
||||
DrawLights(passInfo);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//----- Render Static Object (handled by 3DEngine) ----
|
||||
//-----------------------------------------------------------------------------
|
||||
// calculate LOD
|
||||
|
||||
f32 fDistance = GetViewTM().GetTranslation().GetLength();
|
||||
SRendParams rp;
|
||||
rp.fDistance = fDistance;
|
||||
|
||||
Matrix34 tm;
|
||||
tm.SetIdentity();
|
||||
rp.pMatrix = &tm;
|
||||
rp.pPrevMatrix = &tm;
|
||||
|
||||
Vec3 vAmbient;
|
||||
mv_objectAmbientColor.Get(vAmbient);
|
||||
|
||||
rp.AmbientColor.r = vAmbient.x * mv_lightMultiplier;
|
||||
rp.AmbientColor.g = vAmbient.y * mv_lightMultiplier;
|
||||
rp.AmbientColor.b = vAmbient.z * mv_lightMultiplier;
|
||||
rp.AmbientColor.a = 1;
|
||||
|
||||
rp.nDLightMask = 7;
|
||||
if (mv_lighting == false)
|
||||
{
|
||||
rp.nDLightMask = 0;
|
||||
}
|
||||
|
||||
rp.dwFObjFlags = 0;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//----- Render Static Object (handled by 3DEngine) ----
|
||||
//-----------------------------------------------------------------------------
|
||||
if (m_object)
|
||||
{
|
||||
m_object->Render(rp, passInfo);
|
||||
if (mv_showGrid)
|
||||
{
|
||||
DrawFloorGrid(Quat(IDENTITY), Vec3(ZERO), Matrix33(IDENTITY));
|
||||
}
|
||||
|
||||
if (mv_showBase)
|
||||
{
|
||||
DrawCoordSystem(IDENTITY, 10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
m_renderer->EF_EndEf3D(SHDF_STREAM_SYNC, -1, -1, passInfo);
|
||||
}
|
||||
|
||||
|
||||
void CModelViewport::DrawLights(const SRenderingPassInfo& passInfo)
|
||||
{
|
||||
if (mv_animateLights)
|
||||
{
|
||||
m_LightRotationRadian += m_AverageFrameTime;
|
||||
}
|
||||
|
||||
if (m_LightRotationRadian > gf_PI)
|
||||
{
|
||||
m_LightRotationRadian = -gf_PI;
|
||||
}
|
||||
|
||||
Matrix33 LightRot33 = Matrix33::CreateRotationZ(m_LightRotationRadian);
|
||||
|
||||
Vec3 LPos0 = Vec3(-mv_lightOrbit, mv_lightOrbit, mv_lightOrbit);
|
||||
m_VPLight.SetPosition(LightRot33 * LPos0 + m_PhysicalLocation.t);
|
||||
Vec3 d = mv_lightDiffuseColor;
|
||||
m_VPLight.SetLightColor(ColorF(d.x * mv_lightMultiplier, d.y * mv_lightMultiplier, d.z * mv_lightMultiplier, 0));
|
||||
m_VPLight.SetSpecularMult(mv_lightSpecMultiplier);
|
||||
m_VPLight.m_fRadius = mv_lightRadius;
|
||||
m_VPLight.m_Flags = DLF_SUN | DLF_DIRECTIONAL;
|
||||
|
||||
if (mv_lighting == true)
|
||||
{
|
||||
m_renderer->EF_ADDDlight(&m_VPLight, passInfo);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::PlayAnimation([[maybe_unused]] const char* szName)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::DrawFloorGrid(const Quat& m33, const Vec3& vPhysicalLocation, const Matrix33& rGridRot)
|
||||
{
|
||||
if (!m_renderer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float XR = 45;
|
||||
float YR = 45;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IRenderAuxGeom* pAuxGeom = m_renderer->GetIRenderAuxGeom();
|
||||
pAuxGeom->SetRenderFlags(e_Def3DPublicRenderflags);
|
||||
|
||||
Vec3 axis = m33.GetColumn0();
|
||||
|
||||
Matrix33 SlopeMat33 = rGridRot;
|
||||
uint32 GroundAlign = 1;
|
||||
if (GroundAlign == 0)
|
||||
{
|
||||
SlopeMat33 = Matrix33::CreateRotationAA(m_absCurrentSlope, axis);
|
||||
}
|
||||
|
||||
|
||||
m_GridOrigin = Vec3(floorf(vPhysicalLocation.x), floorf(vPhysicalLocation.y), vPhysicalLocation.z);
|
||||
|
||||
|
||||
Matrix33 ScaleMat33 = IDENTITY;
|
||||
Vec3 rh = Matrix33::CreateRotationY(m_absCurrentSlope) * Vec3(1.0f, 0.0f, 0.0f);
|
||||
if (rh.x)
|
||||
{
|
||||
Vec3 xback = SlopeMat33.GetRow(0);
|
||||
Vec3 yback = SlopeMat33.GetRow(1);
|
||||
f32 ratiox = 1.0f / Vec3(xback.x, xback.y, 0.0f).GetLength();
|
||||
f32 ratioy = 1.0f / Vec3(yback.x, yback.y, 0.0f).GetLength();
|
||||
|
||||
f32 ratio = 1.0f / rh.x;
|
||||
// Vec3 h=Vec3((m_GridOrigin.x-vPhysicalLocation.x)*ratiox,(m_GridOrigin.y-vPhysicalLocation.y)*ratioy,0.0f);
|
||||
Vec3 h = Vec3(m_GridOrigin.x - vPhysicalLocation.x, m_GridOrigin.y - vPhysicalLocation.y, 0.0f);
|
||||
Vec3 nh = SlopeMat33 * h;
|
||||
m_GridOrigin.z += nh.z * ratio;
|
||||
|
||||
ScaleMat33 = Matrix33::CreateScale(Vec3(ratiox, ratioy, 0.0f));
|
||||
|
||||
// float color1[4] = {0,1,0,1};
|
||||
// m_renderer->Draw2dLabel(12,g_ypos,1.6f,color1,false,"h: %f %f %f h.z: %f ratio: %f ratiox: %f ratioy: %f",h.x,h.y,h.z, nh.z,ratio,ratiox,ratioy);
|
||||
// g_ypos+=18;
|
||||
}
|
||||
|
||||
Matrix33 _m33;
|
||||
_m33.SetIdentity();
|
||||
AABB aabb1 = AABB(Vec3(-0.03f, -YR, -0.001f), Vec3(0.03f, YR, 0.001f));
|
||||
OBB _obb1 = OBB::CreateOBBfromAABB(SlopeMat33, aabb1);
|
||||
AABB aabb2 = AABB(Vec3(-XR, -0.03f, -0.001f), Vec3(XR, 0.03f, 0.001f));
|
||||
OBB _obb2 = OBB::CreateOBBfromAABB(SlopeMat33, aabb2);
|
||||
|
||||
SlopeMat33 = SlopeMat33 * ScaleMat33;
|
||||
// Draw grid.
|
||||
float step = 0.25f;
|
||||
for (float x = -XR; x < XR; x += step)
|
||||
{
|
||||
Vec3 p0 = Vec3(x, -YR, 0);
|
||||
Vec3 p1 = Vec3(x, YR, 0);
|
||||
//pAuxGeom->DrawLine( SlopeMat33*p0,RGBA8(0x7f,0x7f,0x7f,0x00), SlopeMat33*p1,RGBA8(0x7f,0x7f,0x7f,0x00) );
|
||||
int32 intx = int32(x);
|
||||
if (fabsf(intx - x) < 0.001f)
|
||||
{
|
||||
pAuxGeom->DrawOBB(_obb1, SlopeMat33 * Vec3(x, 0.0f, 0.0f) + m_GridOrigin, 1, RGBA8(0x9f, 0x9f, 0x9f, 0x00), eBBD_Faceted);
|
||||
}
|
||||
else
|
||||
{
|
||||
pAuxGeom->DrawLine(SlopeMat33 * p0 + m_GridOrigin, RGBA8(0x7f, 0x7f, 0x7f, 0x00), SlopeMat33 * p1 + m_GridOrigin, RGBA8(0x7f, 0x7f, 0x7f, 0x00));
|
||||
}
|
||||
}
|
||||
|
||||
for (float y = -YR; y < YR; y += step)
|
||||
{
|
||||
Vec3 p0 = Vec3(-XR, y, 0);
|
||||
Vec3 p1 = Vec3(XR, y, 0);
|
||||
// pAuxGeom->DrawLine( SlopeMat33*p0,RGBA8(0x7f,0x7f,0x7f,0x00), SlopeMat33*p1,RGBA8(0x7f,0x7f,0x7f,0x00) );
|
||||
int32 inty = int32(y);
|
||||
if (fabsf(inty - y) < 0.001f)
|
||||
{
|
||||
pAuxGeom->DrawOBB(_obb2, SlopeMat33 * Vec3(0.0f, y, 0.0f) + m_GridOrigin, 1, RGBA8(0x9f, 0x9f, 0x9f, 0x00), eBBD_Faceted);
|
||||
}
|
||||
else
|
||||
{
|
||||
pAuxGeom->DrawLine(SlopeMat33 * p0 + m_GridOrigin, RGBA8(0x7f, 0x7f, 0x7f, 0x00), SlopeMat33 * p1 + m_GridOrigin, RGBA8(0x7f, 0x7f, 0x7f, 0x00));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - the grid should probably be an IRenderNode at some point
|
||||
// flushing grid geometry now so it will not override transparent
|
||||
// objects later in the render pipeline.
|
||||
pAuxGeom->Commit();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
void CModelViewport::DrawCoordSystem(const QuatT& location, f32 length)
|
||||
{
|
||||
IRenderAuxGeom* pAuxGeom = m_renderer->GetIRenderAuxGeom();
|
||||
SAuxGeomRenderFlags renderFlags(e_Def3DPublicRenderflags);
|
||||
pAuxGeom->SetRenderFlags(renderFlags);
|
||||
|
||||
Vec3 absAxisX = location.q.GetColumn0();
|
||||
Vec3 absAxisY = location.q.GetColumn1();
|
||||
Vec3 absAxisZ = location.q.GetColumn2();
|
||||
|
||||
const f32 scale = 3.0f;
|
||||
const f32 size = 0.009f;
|
||||
AABB xaabb = AABB(Vec3(-length * scale, -size * scale, -size * scale), Vec3(length * scale, size * scale, size * scale));
|
||||
AABB yaabb = AABB(Vec3(-size * scale, -length * scale, -size * scale), Vec3(size * scale, length * scale, size * scale));
|
||||
AABB zaabb = AABB(Vec3(-size * scale, -size * scale, -length * scale), Vec3(size * scale, size * scale, length * scale));
|
||||
|
||||
OBB obb;
|
||||
obb = OBB::CreateOBBfromAABB(Matrix33(location.q), xaabb);
|
||||
pAuxGeom->DrawOBB(obb, location.t, 1, RGBA8(0xff, 0x00, 0x00, 0xff), eBBD_Extremes_Color_Encoded);
|
||||
pAuxGeom->DrawCone(location.t + absAxisX * length * scale, absAxisX, 0.03f * scale, 0.15f * scale, RGBA8(0xff, 0x00, 0x00, 0xff));
|
||||
|
||||
obb = OBB::CreateOBBfromAABB(Matrix33(location.q), yaabb);
|
||||
pAuxGeom->DrawOBB(obb, location.t, 1, RGBA8(0x00, 0xff, 0x00, 0xff), eBBD_Extremes_Color_Encoded);
|
||||
pAuxGeom->DrawCone(location.t + absAxisY * length * scale, absAxisY, 0.03f * scale, 0.15f * scale, RGBA8(0x00, 0xff, 0x00, 0xff));
|
||||
|
||||
obb = OBB::CreateOBBfromAABB(Matrix33(location.q), zaabb);
|
||||
pAuxGeom->DrawOBB(obb, location.t, 1, RGBA8(0x00, 0x00, 0xff, 0xff), eBBD_Extremes_Color_Encoded);
|
||||
pAuxGeom->DrawCone(location.t + absAxisZ * length * scale, absAxisZ, 0.03f * scale, 0.15f * scale, RGBA8(0x00, 0x00, 0xff, 0xff));
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnLightMultiplier([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::SetSelected(bool const bSelect)
|
||||
{
|
||||
// If a modelviewport gets activated, and listeners will be activated, disable the main viewport listener and re-enable when you lose focus.
|
||||
if (gEnv->pSystem)
|
||||
{
|
||||
IViewSystem* const pIViewSystem = gEnv->pSystem->GetIViewSystem();
|
||||
|
||||
if (pIViewSystem)
|
||||
{
|
||||
pIViewSystem->SetControlAudioListeners(!bSelect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <moc_ModelViewport.cpp>
|
||||
@ -1,258 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#pragma once
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: ModelViewport.h
|
||||
// Version: v1.00
|
||||
// Created: 8/10/2001 by Timur.
|
||||
// Compilers: Visual C++ 6.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef CRYINCLUDE_EDITOR_MODELVIEWPORT_H
|
||||
#define CRYINCLUDE_EDITOR_MODELVIEWPORT_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "RenderViewport.h"
|
||||
#include "Util/Variable.h"
|
||||
#endif
|
||||
|
||||
struct IPhysicalEntity;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
// CModelViewport window
|
||||
class SANDBOX_API CModelViewport
|
||||
: public CRenderViewport
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
Q_OBJECT
|
||||
// Construction
|
||||
public:
|
||||
CModelViewport(const char* settingsPath = "Settings\\CharacterEditorUserOptions", QWidget* parent = nullptr);
|
||||
virtual ~CModelViewport();
|
||||
|
||||
virtual EViewportType GetType() const { return ET_ViewportModel; }
|
||||
virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportModel); };
|
||||
|
||||
virtual void LoadObject(const QString& obj, float scale);
|
||||
|
||||
virtual void OnActivate();
|
||||
virtual void OnDeactivate();
|
||||
|
||||
virtual bool CanDrop(const QPoint& point, IDataBaseItem* pItem);
|
||||
virtual void Drop(const QPoint& point, IDataBaseItem* pItem);
|
||||
|
||||
virtual void SetSelected(bool const bSelect);
|
||||
|
||||
// Callbacks.
|
||||
void OnShowShaders(IVariable* var);
|
||||
void OnShowNormals(IVariable* var);
|
||||
void OnShowTangents(IVariable* var);
|
||||
|
||||
void OnShowPortals(IVariable* var);
|
||||
void OnShowShadowVolumes(IVariable* var);
|
||||
void OnShowTextureUsage(IVariable* var);
|
||||
void OnCharPhysics(IVariable* var);
|
||||
void OnShowOcclusion(IVariable* var);
|
||||
|
||||
void OnLightColor(IVariable* var);
|
||||
void OnLightMultiplier(IVariable* var);
|
||||
void OnDisableVisibility(IVariable* var);
|
||||
|
||||
IStatObj* GetStaticObject(){ return m_object; }
|
||||
|
||||
void GetOnDisableVisibility(IVariable* var);
|
||||
|
||||
const CVarObject* GetVarObject() const { return &m_vars; }
|
||||
CVarObject* GetVarObject() { return &m_vars; }
|
||||
|
||||
virtual void Update();
|
||||
|
||||
|
||||
void UseWeaponIK([[maybe_unused]] bool val) { m_weaponIK = true; }
|
||||
|
||||
void ReleaseObject();
|
||||
void RePhysicalize();
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
Vec3 m_GridOrigin;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
void SetPaused(bool bPaused);
|
||||
bool GetPaused() {return m_bPaused; }
|
||||
|
||||
bool IsCameraAttached() const{ return mv_AttachCamera; }
|
||||
|
||||
virtual void PlayAnimation(const char* szName);
|
||||
|
||||
const QString& GetLoadedFileName() const { return m_loadedFile; }
|
||||
|
||||
void Physicalize();
|
||||
|
||||
protected:
|
||||
|
||||
void LoadStaticObject(const QString& file);
|
||||
|
||||
// Called to render stuff.
|
||||
virtual void OnRender();
|
||||
|
||||
virtual void DrawFloorGrid(const Quat& tmRotation, const Vec3& MotionTranslation, const Matrix33& rGridRot);
|
||||
void DrawCoordSystem(const QuatT& q, f32 length);
|
||||
|
||||
void SaveDebugOptions() const;
|
||||
void RestoreDebugOptions();
|
||||
|
||||
virtual void DrawModel(const SRenderingPassInfo& passInfo);
|
||||
virtual void DrawLights(const SRenderingPassInfo& passInfo);
|
||||
virtual void DrawSkyBox(const SRenderingPassInfo& passInfo);
|
||||
|
||||
void DrawInfo() const;
|
||||
|
||||
void SetConsoleVar(const char* var, int value);
|
||||
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
if (event != eNotify_OnBeginGameMode)
|
||||
{
|
||||
// the base class responds to this by forcing itself to be the current context.
|
||||
// we don't want that to be the case for previewer viewports.
|
||||
CRenderViewport::OnEditorNotifyEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
IStatObj* m_object;
|
||||
IStatObj* m_weaponModel;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
QString m_attachBone;
|
||||
AABB m_AABB;
|
||||
|
||||
struct BBox
|
||||
{
|
||||
OBB obb;
|
||||
Vec3 pos;
|
||||
ColorB col;
|
||||
};
|
||||
std::vector<BBox> m_arrBBoxes;
|
||||
|
||||
// Camera control.
|
||||
float m_camRadius;
|
||||
|
||||
// True to show grid.
|
||||
bool m_bGrid;
|
||||
bool m_bBase;
|
||||
|
||||
QString m_settingsPath;
|
||||
|
||||
bool m_weaponIK;
|
||||
|
||||
QString m_loadedFile;
|
||||
CDLight m_VPLight;
|
||||
|
||||
f32 m_LightRotationRadian;
|
||||
|
||||
class CRESky* m_pRESky;
|
||||
struct ICVar* m_pSkyboxName;
|
||||
IShader* m_pSkyBoxShader;
|
||||
|
||||
//---------------------------------------------------
|
||||
//--- debug options ---
|
||||
//---------------------------------------------------
|
||||
CVariable<bool> mv_showGrid;
|
||||
CVariable<bool> mv_showBase;
|
||||
CVariable<bool> mv_showLocator;
|
||||
CVariable<bool> mv_InPlaceMovement;
|
||||
CVariable<bool> mv_StrafingControl;
|
||||
|
||||
CVariable<bool> mv_showWireframe1; //draw wireframe instead of solid-geometry.
|
||||
CVariable<bool> mv_showWireframe2; //this one is software-wireframe rendered on top of the solid geometry
|
||||
CVariable<bool> mv_showTangents;
|
||||
CVariable<bool> mv_showBinormals;
|
||||
CVariable<bool> mv_showNormals;
|
||||
|
||||
CVariable<bool> mv_showSkeleton;
|
||||
CVariable<bool> mv_showJointNames;
|
||||
CVariable<bool> mv_showJointsValues;
|
||||
CVariable<bool> mv_showStartLocation;
|
||||
CVariable<bool> mv_showMotionParam;
|
||||
CVariable<float> mv_UniformScaling;
|
||||
|
||||
CVariable<bool> mv_printDebugText;
|
||||
CVariable<bool> mv_AttachCamera;
|
||||
|
||||
CVariable<bool> mv_showShaders;
|
||||
|
||||
CVariable<bool> mv_lighting;
|
||||
CVariable<bool> mv_animateLights;
|
||||
|
||||
CVariable<Vec3> mv_backgroundColor;
|
||||
CVariable<Vec3> mv_objectAmbientColor;
|
||||
|
||||
CVariable<Vec3> mv_lightDiffuseColor;
|
||||
CVariable<float> mv_lightMultiplier;
|
||||
CVariable<float> mv_lightSpecMultiplier;
|
||||
CVariable<float> mv_lightRadius;
|
||||
CVariable<float> mv_lightOrbit;
|
||||
|
||||
CVariable<float> mv_fov;
|
||||
CVariable<bool> mv_showPhysics;
|
||||
CVariable<bool> mv_useCharPhysics;
|
||||
CVariable<bool> mv_showPhysicsTetriders;
|
||||
CVariable<int> mv_forceLODNum;
|
||||
|
||||
CVariableArray mv_advancedTable;
|
||||
|
||||
CVarObject m_vars;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
public slots:
|
||||
virtual void OnAnimPlay();
|
||||
virtual void OnAnimBack();
|
||||
virtual void OnAnimFastBack();
|
||||
virtual void OnAnimFastForward();
|
||||
virtual void OnAnimFront();
|
||||
protected:
|
||||
bool m_bPaused;
|
||||
|
||||
void OnDestroy();
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
struct VariableCallbackIndex
|
||||
{
|
||||
enum : unsigned char
|
||||
{
|
||||
OnCharPhysics = 0,
|
||||
OnLightColor,
|
||||
OnLightMultiplier,
|
||||
OnShowShaders,
|
||||
|
||||
// must be at the end
|
||||
Count,
|
||||
};
|
||||
};
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZStd::fixed_vector< IVariable::OnSetCallback, VariableCallbackIndex::Count > m_onSetCallbacksCache;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_MODELVIEWPORT_H
|
||||
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "PanelPreview.h"
|
||||
|
||||
// Qt
|
||||
#include <QBoxLayout>
|
||||
|
||||
// CPanelPreview dialog
|
||||
|
||||
CPanelPreview::CPanelPreview(QWidget* pParent /*=nullptr*/)
|
||||
: QWidget(pParent)
|
||||
, m_previewCtrl(new CPreviewModelCtrl(this))
|
||||
{
|
||||
QBoxLayout* layout = new QHBoxLayout;
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_previewCtrl);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CPanelPreview::LoadFile(const QString& filename)
|
||||
{
|
||||
if (!filename.isEmpty())
|
||||
{
|
||||
m_previewCtrl->EnableUpdate(false);
|
||||
m_previewCtrl->LoadFile(filename, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_PANELPREVIEW_H
|
||||
#define CRYINCLUDE_EDITOR_PANELPREVIEW_H
|
||||
#pragma once
|
||||
|
||||
// CPanelPreview dialog
|
||||
|
||||
#include "Controls/PreviewModelCtrl.h"
|
||||
|
||||
|
||||
class CPanelPreview
|
||||
: public QWidget
|
||||
{
|
||||
public:
|
||||
CPanelPreview(QWidget* pParent = nullptr); // standard constructor
|
||||
|
||||
void LoadFile(const QString& filename);
|
||||
|
||||
QSize sizeHint() const override
|
||||
{
|
||||
return QSize(130, 240);
|
||||
}
|
||||
|
||||
protected:
|
||||
CPreviewModelCtrl* m_previewCtrl;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_PANELPREVIEW_H
|
||||
@ -1,198 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "ThumbnailGenerator.h"
|
||||
|
||||
// Editor
|
||||
#include "Util/Image.h"
|
||||
#include "Util/ImageUtil.h" // for CUmageUtil
|
||||
#include "WaitProgress.h" // for CWaitProgress
|
||||
|
||||
#if defined(AZ_PLATFORM_MAC) || defined(AZ_PLATFORM_LINUX)
|
||||
#include <sys/types.h>
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
CThumbnailGenerator::CThumbnailGenerator(void)
|
||||
{
|
||||
}
|
||||
|
||||
CThumbnailGenerator::~CThumbnailGenerator(void)
|
||||
{
|
||||
}
|
||||
|
||||
// Get directory contents.
|
||||
static bool scan_directory(const QString& root, const QString& path, const QString& file, QStringList& files, bool recursive)
|
||||
{
|
||||
QString fullPath = root + path + file;
|
||||
QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags;
|
||||
if (recursive)
|
||||
{
|
||||
flags = QDirIterator::Subdirectories;
|
||||
}
|
||||
QDirIterator dirIterator(fullPath, {file}, QDir::Files, flags);
|
||||
if (!dirIterator.hasNext())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find the rest of the .c files.
|
||||
while (dirIterator.hasNext())
|
||||
{
|
||||
files.push_back(dirIterator.next());
|
||||
//FileInfo fi;
|
||||
//fi.attrib = c_file.attrib;
|
||||
//fi.name = path + c_file.name;
|
||||
/*
|
||||
// Add . after file name without extension.
|
||||
if (fi.name.find('.') == CString::npos) {
|
||||
fi.name.append( "." );
|
||||
}
|
||||
*/
|
||||
//fi.size = c_file.size;
|
||||
//fi.time = c_file.time_write;
|
||||
//files.push_back( fi );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
#define FileTimeType FILETIME
|
||||
|
||||
inline void GetThumbFileTime(const char* fileName, FILETIME& time)
|
||||
{
|
||||
HANDLE hFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (INVALID_HANDLE_VALUE != hFile)
|
||||
{
|
||||
GetFileTime(hFile, NULL, NULL, &time);
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
}
|
||||
|
||||
inline void SetThumbFileTime(const char* fileName, FILETIME& time)
|
||||
{
|
||||
HANDLE hFile = CreateFile(fileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (INVALID_HANDLE_VALUE != hFile)
|
||||
{
|
||||
SetFileTime(hFile, NULL, NULL, &time);
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool ThumbFileTimeIsEqual(const FILETIME& ft1, const FILETIME& ft2)
|
||||
{
|
||||
return ft1.dwHighDateTime == ft2.dwHighDateTime && ft1.dwLowDateTime == ft2.dwLowDateTime;
|
||||
}
|
||||
#elif defined(AZ_PLATFORM_MAC) || defined(AZ_PLATFORM_LINUX)
|
||||
#define FileTimeType utimbuf
|
||||
|
||||
inline void GetThumbFileTime(const char* fileName, utimbuf& times)
|
||||
{
|
||||
struct stat sb;
|
||||
if (stat(fileName, &sb) == 0)
|
||||
{
|
||||
times.actime = sb.st_atime;
|
||||
times.modtime = sb.st_mtime;
|
||||
}
|
||||
}
|
||||
|
||||
inline void SetThumbFileTime(const char* fileName, const utimbuf& times)
|
||||
{
|
||||
utime(fileName, ×);
|
||||
}
|
||||
|
||||
inline bool ThumbFileTimeIsEqual(const utimbuf& ft1, const utimbuf& ft2)
|
||||
{
|
||||
return ft1.modtime == ft2.modtime;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CThumbnailGenerator::GenerateForDirectory(const QString& path)
|
||||
{
|
||||
return;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QStringList files;
|
||||
//CString dir = GetIEditor()->GetPrimaryCDFolder();
|
||||
QString dir = path;
|
||||
scan_directory(dir, "", "*.*", files, true);
|
||||
|
||||
I3DEngine* engine = GetIEditor()->Get3DEngine();
|
||||
|
||||
int thumbSize = 128;
|
||||
CImageEx image;
|
||||
image.Allocate(thumbSize, thumbSize);
|
||||
|
||||
char drive[_MAX_DRIVE];
|
||||
char fdir[_MAX_DIR];
|
||||
char fname[_MAX_FNAME];
|
||||
char fext[_MAX_EXT];
|
||||
char bmpFile[1024];
|
||||
|
||||
GetIEditor()->ShowConsole(true);
|
||||
CWaitProgress wait("Generating CGF Thumbnails");
|
||||
for (int i = 0; i < files.size(); i++)
|
||||
{
|
||||
QString file = dir + files[i];
|
||||
_splitpath_s(file.toUtf8().data(), drive, fdir, fname, fext);
|
||||
|
||||
//if (_stricmp(fext,".cgf") != 0 && _stricmp(fext,".bld") != 0)
|
||||
if (_stricmp(fext, ".cgf") != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!wait.Step(100 * i / files.size()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
_makepath_s(bmpFile, drive, fdir, fname, ".tmb");
|
||||
|
||||
FileTimeType ft1, ft2;
|
||||
GetThumbFileTime(file.toUtf8().data(), ft1);
|
||||
GetThumbFileTime(bmpFile, ft2);
|
||||
// Both cgf and bmp have same time stamp.
|
||||
if (ThumbFileTimeIsEqual(ft1, ft2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//CLogFile::FormatLine( "Generating thumbnail for %s...",file );
|
||||
|
||||
_smart_ptr<IStatObj> obj = engine->LoadStatObjAutoRef(file.toUtf8().data(), NULL, NULL, false);
|
||||
if (obj)
|
||||
{
|
||||
assert(!"IStatObj::MakeObjectPicture does not exist anymore");
|
||||
// obj->MakeObjectPicture( (unsigned char*)image.GetData(),thumbSize );
|
||||
|
||||
CImageUtil::SaveBitmap(bmpFile, image);
|
||||
SetThumbFileTime(bmpFile, ft1);
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
SetFileAttributes(bmpFile, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
|
||||
#endif
|
||||
obj->Release();
|
||||
}
|
||||
}
|
||||
//GetIEditor()->ShowConsole( false );
|
||||
}
|
||||
|
||||
void CThumbnailGenerator::GenerateForFile([[maybe_unused]] const QString& fileName)
|
||||
{
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_THUMBNAILGENERATOR_H
|
||||
#define CRYINCLUDE_EDITOR_THUMBNAILGENERATOR_H
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
class CThumbnailGenerator
|
||||
{
|
||||
public:
|
||||
CThumbnailGenerator(void);
|
||||
~CThumbnailGenerator(void);
|
||||
|
||||
void GenerateForDirectory(const QString& path);
|
||||
void GenerateForFile(const QString& fileName);
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_THUMBNAILGENERATOR_H
|
||||
@ -1,34 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>TimeOfDay/main-00.png</file>
|
||||
<file>TimeOfDay/main-01.png</file>
|
||||
<file>TimeOfDay/main-02.png</file>
|
||||
<file>TimeOfDay/main-03.png</file>
|
||||
<file>TimeOfDay/main-04.png</file>
|
||||
<file>TimeOfDay/main-05.png</file>
|
||||
<file>TimeOfDay/main-06.png</file>
|
||||
<file>TimeOfDay/main-07.png</file>
|
||||
<file>TimeOfDay/main-08.png</file>
|
||||
<file>TimeOfDay/main-09.png</file>
|
||||
<file>TimeOfDay/main-10.png</file>
|
||||
<file>TimeOfDay/main-11.png</file>
|
||||
<file>TimeOfDay/main-12.png</file>
|
||||
<file>Common/spline_edit-00.png</file>
|
||||
<file>Common/spline_edit-01.png</file>
|
||||
<file>Common/spline_edit-02.png</file>
|
||||
<file>Common/spline_edit-03.png</file>
|
||||
<file>Common/spline_edit-04.png</file>
|
||||
<file>Common/spline_edit-05.png</file>
|
||||
<file>Common/spline_edit-06.png</file>
|
||||
<file>Common/spline_edit-07.png</file>
|
||||
<file>Common/spline_edit-08.png</file>
|
||||
<file>Common/spline_edit-09.png</file>
|
||||
<file>Common/spline_edit-10.png</file>
|
||||
<file>Common/spline_edit-11.png</file>
|
||||
<file>Common/spline_edit-12.png</file>
|
||||
<file>Common/spline_edit-13.png</file>
|
||||
<file>Common/spline_edit-14.png</file>
|
||||
<file>Common/spline_edit-15.png</file>
|
||||
<file>Common/spline_edit-16.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue