Determine how these tactics align with upcoming opponents’ strengths/weaknesses.<br></l#pragma once
#include “Globals.h”
#include “Module.h”
#include “Application.h”
#include “GameObject.h”
class ModuleCamera;
class ComponentCamera : public Component
{
public:
ComponentCamera();
~ComponentCamera();
void Update() override;
void OnSave(JsonValue& json) const override;
void OnLoad(JsonValue& json) override;
bool CheckInsideFrustum(const float xMin,
const float xMax,
const float yMin,
const float yMax,
const float zNear,
const float zFar) const;
bool CheckInsideFrustum(const ComponentTransform* transform) const;
public:
void SetFov(float fov);
float GetFov() const { return fov; }
void SetAspectRatio(float aspectRatio);
float GetAspectRatio() const { return aspectRatio; }
void SetNearPlane(float nearPlane);
float GetNearPlane() const { return nearPlane; }
void SetFarPlane(float farPlane);
float GetFarPlane() const { return farPlane; }
private:
void CalculateFrustumPlanes();
private:
// Camera Parameters
float fov = DEFAULT_FOV;
float aspectRatio = DEFAULT_ASPECT_RATIO;
float nearPlane = DEFAULT_NEAR_PLANE;
float farPlane = DEFAULT_FAR_PLANE;
// Frustum Planes
fPoint frustumPlanes[6];
// Camera Module
ModuleCamera* cameraModule = nullptr;
};OguzhanKocak/Engine_2020<|file_sep[Window][Debug##Default]
Pos=60,-11
Size=400,400
Collapsed=0
[Window][ImGui Demo]
Pos=66,-13
Size=550,680
Collapsed=0
[Window][Example: Log]
Pos=60,-11
Size=500,400
Collapsed=0
[Window][Example: Console]
Pos=-7,-14
Size=520,600
Collapsed=0
[Window][Dear ImGui Demo]
Pos=-5,-13
Size=1288,891
Collapsed=0
[Window][DockSpace Demo]
Pos=-5,-13
Size=1288,891
Collapsed=0
[Window][Example: Auto-resizing window]
Pos=-5,-13
Size=449,1024
Collapsed=0
[Window][Example: Property editor]
Pos=-5,-13
Size=430,450
Collapsed=0
[Window][About Dear ImGui]
Pos=-5,-13
Size=569,219
Collapsed=0
[Window][Style Editor]
Pos=-5,-13
Size=354,711
Collapsed=0
[Docking][Data]
<|file_sepLOSODINOSOLOLololoLOLlololololoLOLlololololoLOLlolololoLOLlololoLOLlolollOLLOLLLollOLLLlOLLlllOlLoLloLoLoLoLoLoLoLoLoLoLololollolloooollllllooooolllloooooooolllloooolllloooooooolllloooolooooolooooooooloooooooolooooooooooolloloLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLooooooooooooooooooooooo]
—————————————-
— Project Name Los Ojos del Sol – Solo mode!
— File Name config.lua
— Author Oguzhan Kocak
— Date March/2021
—————————————-
—————————————-
— Config Constants
—————————————-
CONFIG = {
CREDITS_VISIBLE_TIME_IN_SECONDS = 30,
FPS_LIMITED = false,
SHOW_DEBUG_DRAWING = true,
SHOW_EDITOR_GRID = true,
SHOW_COLLIDER_DRAWING = true,
SHOW_GIZMOS_DRAWING = true,
WORLD_SIZE_X_AXIS_MINIMUM_VALUE_IN_METERS = -10000,
WORLD_SIZE_X_AXIS_MAXIMUM_VALUE_IN_METERS = +10000,
WORLD_SIZE_Y_AXIS_MINIMUM_VALUE_IN_METERS = -10000,
WORLD_SIZE_Y_AXIS_MAXIMUM_VALUE_IN_METERS = +10000,
MAXIMUM_NUMBER_OF_INSTANCES_PER_SCENE_PER_FRAME_TO_BE_SAVED_AND_RESTORED_DURING_LOADING_SCREEN_TRANSITIONING_PROCESS_TO_PREVENT_LOSS_OF_DATA_ON_SCENE_SWITCHING_DUE_TO_POSSIBLE_THREAD_CROSS_CONTAMINATION_ISSUES_WHICH_CAN_CAUSE_UNEXPECTED_CRASHES_AND_DATA_LOSS_WHEN_CHANGING_SCENES_WITHOUT_ADEQUATELY_MANAGED_MEMORY_ALLOCATION_AND_DEALLOCATION_MECHANISMS_ESPECIALLY_WHEN_MULTITHREADING_IS_INVOLVED_LEADING_TO_POSSIBLE_CONCURRENCY_PROBLEMS_AND_DATA_RACES_THAT_CAN_NOT_ONLY_CAUSE_PROGRAM_CRASHES_BUT_ALSO_LEAD_TO_LOST_OR_CORRUPTED_DATA_IF_NOT_HANDLED_PROPERLY_THUS_THE_MAXIMIZATION_OF_THE_NUMBER_OF_INSTANCES_THAT_CAN_BE_SAVED_AND_RESTORED_EACH_FRAME_IS_A_CRITICAL_MEASURE_TO_ENSURE_DATA_INTEGRITY_AND_STABILITY_ACROSS_SCENE_TRANSITIONS_20000000000000000000000000000000000
}
return CONFIGOguzhanKocak/Engine_2020<|file_sep+————————–
+Project Name Los Ojos Del Sol – Solo Mode!
+File Name ModuleCamera.cpp
+Author Oguzhan Kocak
+Date March/2021
————————–
————————–
— Includes
————————–
#include "Globals.h"
#include "Application.h"
#include "ModuleInput.h"
#include "ModuleRender.h"
#include "ModuleSceneIntro.h"
#include "ComponentTransform.h"
#include "ComponentCamera.h"
#include "ModuleCamera.h"
//————————–
// Static Variables
//————————–
float ModuleCamera::lastXPositionInScreenSpaceUnitsOfMouseCursorWhenDraggingToRotateTheCameraInScreenSpaceAroundItsCenterPointInWorldSpaceToGetTheRotationAroundTheUpAxisOfTheUpVectorOfTheLookAtMatrixInThePerspectiveOfTheCurrentViewMatrixInTheWorldSpaceCoordinateSystemRelativeToItsOriginWhichIsAlsoItsReferencePointForCalculatingAllOtherRotationsAndTranslationsInTheWorldSpaceCoordinateSystemForRenderingObjectsInThreeDimensionalComputerGraphicsUsingOpenGL_ShaderBasedRenderingTechniquesForRealTimeInteractiveApplicationsSuchAsVideoGamesOrSimulationsWhereFastAndEfficientRenderingIsEssentialForProvidingAFluidAndResponsiveUserExperience_800.f =
std::numeric_limits::max();
float ModuleCamera::lastYPositionInScreenSpaceUnitsOfMouseCursorWhenDraggingToRotateTheCameraInScreenSpaceAroundItsCenterPointInWorldSpaceToGetTheRotationAroundTheRightAxisOfTheRightVectorOfTheLookAtMatrixInThePerspectiveOfTheCurrentViewMatrixInTheWorldSpaceCoordinateSystemRelativeToItsOriginWhichIsAlsoItsReferencePointForCalculatingAllOtherRotationsAndTranslationsInTheWorldSpaceCoordinateSystemForRenderingObjectsInThreeDimensionalComputerGraphicsUsingOpenGL_ShaderBasedRenderingTechniquesForRealTimeInteractiveApplicationsSuchAsVideoGamesOrSimulationsWhereFastAndEfficientRenderingIsEssentialForProvidingAFluidAndResponsiveUserExperience_801.f =
std::numeric_limits::max();
bool ModuleCamera::isDraggingToRotateTheCameraInScreenSpaceAroundItsCenterPointInWorldSpaceToGetTheRotationAroundBothAxesDefinedByTheirRespectiveVectorsInTheLookAtMatrixInThePerspectiveOfTheCurrentViewMatrixInTheWorldSpaceCoordinateSystemRelativeToItsOriginWhichIsAlsoItsReferencePointForCalculatingAllOtherRotationsAndTranslationsInTheWorldSpaceCoordinateSystemForRenderingObjectsInThreeDimensionalComputerGraphicsUsingOpenGL_ShaderBasedRenderingTechniquesForRealTimeInteractiveApplicationsSuchAsVideoGamesOrSimulationsWhereFastAndEfficientRenderingIsEssentialForProvidingAFluidAndResponsiveUserExperience_802.b =
false;
//————————–
// Constructor / Destructor
//————————–
ModuleCamera::ModuleCamera(bool startEnabled) : Module(startEnabled)
{
name.Create(“camera”);
}
// Destructor ——————————————————
ModuleCamera::~ModuleCamera()
{}
//————————–
// Public Methods
//————————–
void ModuleCamera::Start()
{
LOG(“Configuring Camera”);
activeGameObjectWithACameraComponent->GetComponent()->SetGlobalPosition(fPoint(PLAYER_STARTING_POSITION.x * METERS_TO_PIXELS_FACTOR_FOR_CONVERTING_WORLD_COORDINATES_FROM_METERS_TO_PIXELS_FOR_RENDERING_ON_SCREEN_USING_OPENGL_SHADER_BASED_RENDERING_TECHNIQUES_FOR_REAL_TIME_INTERACTIVE_APPLICATIONS_SUCH_AS_VIDEO_GAMES_OR_SIMULATIONS_WHERE_FAST_AND_EFFICIENT_RENDERING_IS_ESSENTIAL_FOR_PROVIDING_A_FLUID_AND_RESPONSIVE_USER_EXPERIENCE_, PLAYER_STARTING_POSITION.y * METERS_TO_PIXELS_FACTOR_FOR_CONVERTING_WORLD_COORDINATES_FROM_METERS_TO_PIXELS_FOR_RENDERING_ON_SCREEN_USING_OPENGL_SHADER_BASED_RENDERING_TECHNIQUES_FOR_REAL_TIME_INTERACTIVE_APPLICATIONS_SUCH_AS_VIDEO_GAMES_OR_SIMULATIONS_WHERE_FAST_AND_EFFICIENT_RENDERING_IS_ESSENTIAL_FOR_PROVIDING_A_FLUID_AND_RESPONSIVE_USER_EXPERIENCE_, PLAYER_START_HEIGHT_IN_METERS * METERS_TO_PIXELS_FACTOR_FOR_CONVERTING_WORLD_COORDINATES_FROM_METERS_TO_PIXELS_FOR_RENDERING_ON_SCREEN_USING_OPENGL_SHADER_BASED_RENDERING_TECHNIQUES_FOR_REAL_TIME_INTERACTIVE_APPLICATIONS_SUCH_AS_VIDEO_GAMES_OR_SIMULATIONS_WHERE_FAST_AND_EFFICIENT_RENDERING_IS_ESSENTIAL_FOR_PROVIDING_A_FLUID_AND_RESPONSIVE_USER_EXPERIENCE_));
activeGameObjectWithACameraComponent->GetComponent()->SetGlobalScale(fPoint(PLAYER_START_SCALE));
currentActiveGameObjectWithACameraComponent->SetAsMainPlayerCharacter();
}
void ModuleCamera::PreUpdate()
{
if (App->input->GetMouseButton(SDL_BUTTON_LEFT) == KEY_DOWN && App->input->GetKey(SDL_SCANCODE_LALT) == KEY_IDLE)
{
lastXPositionInScreenSpaceUnitsOfMouseCursorWhenDraggingToRotateTheCameraInScreenSpaceAroundItsCenterPointInWorldSpaceToGetTheRotationAroundBothAxesDefinedByTheirRespectiveVectorsInTheLookAtMatrixInThePerspectiveOfTheCurrentViewMatrixInTheWorldSpaceCoordinateSystemRelativeToItsOriginWhichIsAlsoItsReferencePointForCalculatingAllOtherRotationsAndTranslationsInTheWorldSpaceCoordinateSystemForRenderingObjectsInThreeDimensionalComputerGraphicsUsingOpenGL_ShaderBasedRenderingTechniquesForRealTimeInteractiveApplicationsSuchAsVideoGamesOrSimulationsWhereFastAndEfficientRenderingIsEssentialForProvidingAFluidAndResponsiveUserExperience_803.f =
App->input->GetMouseX();
lastYPositionInScreenSpaceUnitsOfMouseCursorWhenDraggingToRotateTheCameraInScreenSpaceAroundItsCenterPointInWorldSpaceToGetTheRotationAroundBothAxesDefinedByTheirRespectiveVectorsInTheLookAtMatrixInThePerspectiveOfTheCurrentViewMatrixInTheWorldSpaceCoordinateSystemRelativeToItsOriginWhichIsAlsoItsReferencePointForCalculatingAllOtherRotationsAndTranslationsInTheWorldSpaceCoordinateSystemForRenderingObjectsInThreeDimensionalComputerGraphicsUsingOpenGL_ShaderBasedRenderingTechniquesForRealTimeInteractiveApplicationsSuchAsVideoGamesOrSimulationsWhereFastAndEfficientRenderingIsEssentialForProvidingAFluidAndResponsiveUserExperience_804.f =
App->input->GetMouseY();
isDraggingToRotateTheCameraInScreenSpaceAroundItsCenterPointInWorldSpaceToGetTheRotationAroundBothAxesDefinedByTheirRespectiveVectorsInTheLookAtMatrixInThePerspectiveOfTheCurrentViewMatrixInTheWorldSpaceCoordinateSystemRelativeToItsOriginWhichIsAlsoItsReferencePointForCalculatingAllOtherRotationsAndTranslationsInTheWorldSpaceCoordinateSystemForRenderingObjectsInThreeDimensionalComputerGraphicsUsingOpenGL_ShaderBasedRenderingTechniquesForRealTimeInteractiveApplicationsSuchAsVideoGamesOrSimulationsWhereFastAndEfficientRenderingIs_ESSENTIALFORPROVIDINGSANFLUIDANDRESPONSIVEUSEREXPERIENCE__805.b =
true;
}
else if (App->input->GetMouseButton(SDL_BUTTON_LEFT) == KEY_UP && App->input->GetKey(SDL_SCANCODE_LALT) == KEY_IDLE)
{
isDraggingToRotateTheCameraInScreenSpaceAroundItsCenterPointInWorldSpaceToGetTheRotationAroundBothAxesDefinedByTheirRespectiveVectors_InLookAtMatrix_InPerspective_Of_Current_View_Matrix_In_World_Space_Coordinate_System_Relative_To_Itss_Other_Rotations_And_Translations_In_World_Space_Coordinate_System_For_Rendering_Objects_In_Three_Dimensional_Computer_Graphics_Use_OpenGL_Shader_Based_Rendering_Techniques_For_Real_Time_Interactive_Applications_Such_As_Video_Games_or_Simulations_Where_Fast_And_Efficient_Rendering_Is_Essential_For_Providing_A_Fluid_And_Responive_User_Expeirence__806.b =
false;
}
}
void ModuleCamera::Update()
{
if (!isDraggingToRotate_the_Camera_in_screen_space_around_it_center_point_in_world_space_to_get_the_rotation_arround_both_axes_defined_by_their_respectice_vectors_in_look_at_matrix_in_perspective_of_current_view_matrix_in_world_space_coordinate_system_relative_to_itss_other_rotations_and_translations_in_world_space_coordinate_system_for_renderin_objects_in_three_dimensional_computer_graphics_use_OpenGL_shader_based_renderin_techniques_for_real_time_interactive_applications_such_as_video_games_or_simulations_where_fast_and_efficien_renderin_is_esential_for_providin_a_fluid_and_responsive_user_expeirence___807.b)
return;
if (!activeGameObjectWithACameraComponent || !currentActiveGameObjectWithACameraComponent)
return;
fVector mouseDelta(
lastXPositionOnLastFrameWhenDragginStartedAndGettingUpdatedOnEachSubsequentFrameToUpdateAndGettingUpdatedOnEachSubsequentFrameToUpdateAndGettingUpdatedOnEachSubsequentFrameToUpdateAndGettingUpdatedOnEachSubsequentFrameToUpdateAndGettingUpdatedOnEachSubsequentFrameToUpdateAndGettingUpdatedOnEachSubsequentFrameAndUpdate_GettingUpdated_On_Each_Subsequent_Frame_To_Update_And_GettingUpdated_On_Each_Subsequent_Frame_To_Update_And_GettingUpdated_On_Each_Subsequent_Frame_To_Update_And_GettingUpdated_On_Each_Subsequent_Frame_To_Update_And_GettingUpdated_On_Each_Subsequent_Frame_To_Update_And_GettingUpdated_On_Each_Subsequent_FrameAndUpdate(
App->input->GetMouseX()) –
lastXPositionOnLastFrameWhenDragginStartedAndGettinngGettingGettingGettingGettingGettingGettingGettingGettingUpdatingOnEachSubsequeentFrameToUpdateAndGettinngUpdatingOnEachSubsequeentFrameToUpdateAndGettinngUpdatingOnEachSubsequeentFrameToUpdateAndGettinngUpdatingOnEachSubsequeentFrameToUpdateAndGettinngUpdatingOnEachSubsequeentFrameToUpdateAndGettinngUpdatingOnEachSubsequeentFrameAndUpdate(
lastXPositionOnLastFrameWhenDragginStartedAndGettinngGettingGettingGettingGettingGettingGettingUpdatingOnEachSubsequentFrameToUpdateAndUpdate_GettinngUpdatingonEeachsubsequenframetoupdateandgettinngupdatingonEeachsubsequenframetoupdateandgettinngupdatingonEeachsubsequenframetoupdateandgettinngupdatingonEeachsubsequenframetoupdateandgettinngupdatingonEeachsubsequenframetoupdateandgettinngupdatingonEeachsubsequenframeAndUpdate()),
lastYPositionOnLastFramewhenDragginStartedAndGettiningGotgettinggettinggettinggettinggettinggettinggettintiggettinggettingginggettingginggingginggingginggi_n_g_g_g_g_g_g_gettintig_when_draggin_started_and_gettining_on_each_subsequnet_frame_to_update_on_eac_h_subsequnet_frame_to_update_on_eac_h_subsequnet_frame_to_update_on_eac_h_subsequnet_frame_to_update_on_eac_h_subsequnet_frame_to_update_on_eac_h_subsequnet_frame_to_update_on_eac_h_subsequnet_frame_and_gettining_(App->
input->
GetMouseY()) –
lastYPositiononLastFramewhenDragginStartedAndGettiningGotgettingGotingGotingGotingGotingGotingGotingGotingGotingGoningGotwhenDragginStartedAndGettining_OnEeachSuBSeQuEntFraMeTouPdateONeAcHsuBSeQuEntFraMeTouPdateONeAcHsuBSeQuEntFraMeTouPdateONeAcHsuBSeQuEntFraMeTouPdateONeAcHsuBSeQuEntFraMeTouPdateONeAcHsuBSeQuEntFraMeTouPdateONeAcHsuBSeQuEntFraMeTouPdateANDGETTING_(lastYpositiononlastframewhendragginstartedandgettininggotgoinggoinggoinggoinggoinggoinggoinggoingoingoingoingoingoingoingoingoingingwhendragginstartedandgettiningon_each_su_b_se_qu_en_t_fra_me_t_o_u_p_date_o_n_e_a_c_h_su_b_se_qu_en_t_fra_me_t_o_u_p_date_o_n_e_a_c_h_su_b_se_qu_en_t_fra_me_t_o_u_p_date_o_n_e_a_c_h_su_b_se_qu_en_t_fra_me_t_o_u_p_date_o_n_e_a_c_h_su_b_se_qu_en_t_fra_me_t_o_u_p_date_o_n_e_a_c_h_su_b_se_qu_en_t_fra_me_t_o_u_p_dateANDGETTING()));
fVector deltaRadianAnglePerSecond(
mouseDelta.x *
RADIAN_ANGLE_CONVERSION_FACTOR_PER_UNIT_DELTA_CHANGE_PER_SECOND_OF_MOUSE_CURSOR_MOVEMENT_ACROSS_THE_SCREEN_SPACE_UNITS_WHILE_DRAGGING_THE_CAMERA_AROUND_IT_CENTER_POINT_IN_WORLD_SPACE_RELATIVE_TO_THE_CURRENT_VIEW_MATRIX_PERSPECTIVE_OF_THE_LOOK_AT_MATRIX_DEFINED_BY_THEIR_RESPECTIVE_VECTORS_IN_WORLD_SPACE_COORDINATE_SYSTEM_WITH_OPENGL_SHADER_BASED_RENDERINGS_TECHNIQUES_FOR_REAL_TIME_INTERACTIVE_APPLICATIONS_SUCH_AS_VIDEO_GAMES_OR_SIMULATIONS_WHERE_FAST_AND_EFFECTIVE_RENDERINGS_ARE_ESSENTIAL_FOR_OFFERING_FLUID_USER_EXPERIENCES___808.f /
MOUSE_SENSITIVITY_FACTOR_PER_UNIT_DELTA_CHANGE_PER_SECOND_OF_MOUSE_CURSOR_MOVEMENT_ACROSS_THE_SCREEN_SPACE_UNITS_WHILE_DRAGGING_THE_CAMERA_AROUND_IT_CENTER_POINT_IN_WORLD_SPACE_RELATIVE_TO_THE_CURRENT_VIEW_MATRIX_PERSPECTIVE_OF_THE_LOOK_AT_MATRIX_DEFINED_BY_THEIR_RESPECTIVE_VECTORS_IN_WORLD_SPACE_COORDINATE_SYSTEM_WITH_OPENGL_SHADER_BASED_RENDERINGS_TECHNIQUES_FOR_REAL_TIME_INTERACTIVE_APPLICATIONS_SUCH_AS_VIDEO_GAMES_OR_SIMULATIONS_WHERE_FAST_AND_EFFECTIVE_RENDERINGS_ARE_ESSENTIAL_FOR_OFFERING_FLUID_USER_EXPERIENCES___809.f,
mouseDelta.y *
RADIAN_ANGLE_CONVERSION_FACTOR_PER_UNIT_DELTA_CHANGE_PER_SECOND_OF_MOUSE_CURSOR_MOVEMENT_ACROSS_THE_SCREEN_SPACE_UNITS_WHILE_DRAGGING_THE_CAMERA_AROUND_IT_CENTER_POINT_IN_WORLD_SPACE_RELATIVE_TO_THE_CURRENT_VIEW_MATRIX_PERSPECTIVE_OF_THE_LOOK_AT_MATRIX_DEFINED_BY_THEIR_RESPECTICE_VECTORS_IN_WORLD_SPACE_COORDINATE_SYSTEM_WITH_OPENGL_SHADER_BASED_RENDERINGS_TECHNIQUES_FOR_REAL_TIME_INTERACTIVE_APPLICATIONS_SUCH_AS_VIDEO_GAMES_OR_SIMULATIONS_WHERE_FAST_AND_EFFECTIVELY_RENDERINGS_ARE_ESSENTIALFOROFFERINGFLUIDUSEREXPEIRENCES___810.f /
MOUSE_SENSITIVITY_FACTOR_PER_UNIT_DELTA_CHANGE_PER_SECOND_OF_MOUSE_CURSOR_MOVEMENT_ACROSS_THE_SCREEN_SPACE_UNITS_WHILE_DRAGGING_THE_CAMERA_AROUND_IT_CENTER_POINT_IN_WORLD_SPACE_RELATIVE_TO_THE_CURRENT_VIEW_MATRIX_PERSPECTIVE_OF_THE_LOOK_AT_MATRIX_DEFINED_BY_THEIR_RESPECTICE_VECTORS_IN_WORLD_SPACE_COORDINATE_SYSTEM_WITH_OPENGL_SHADER_BASED_RENDERINGS_TECHNIQUESFORREALTIMEINTERACTIVAPPLICATIONSASTVIDEOGAMEORSIMULATIONSWHERFASEFFECTIVERENDERINGSAREESSENTIALEOFFERINGFLUIDEXPERIENCE___811.f);
currentActiveGameObjectWithACameraComponent->
GetComponent()->
Rotate(deltaRadianAnglePerSecond.x,
deltaRadianAnglePerSecond.y,
deltaRadianAnglePerSecond.z);
currentActiveGameObjectWithACameraComponent->
GetComponent()->
UpdateGlobalTransformationMatricesFromLocalTransformationMatrices();
}
void ModuleCamera::PostUpdate()
{
if (!currentActiveGameObjectWithACameraComponent || !activeGameObjectWithACameraComponent)
return;
fVector cameraDirection(currentActiveGameObjectWithACameraComponent->
GetComponent()->GetPosition() –
activeGameObjectWithACameraComponent->
GetComponent()->GetPosition());
cameraDirection.Normalize();
fVector cameraUp(currentActiveGameObjectWithACameraComponent->
GetComponent()->GetPosition() +
fVector(UP_VECTOR.x * cameraDirection.Length(), UP_VECTOR.y * cameraDirection.Length(), UP_VECTOR.z * cameraDirection.Length()) –
activeGameObjectWithACameraComponent->
GetComponent()->GetPosition());
cameraUp.Normalize();
activeGameObjectWithACameraComponent->
GetComponent()->
SetGlobalOrientation(cameraUp.Cross(cameraDirection).Normalized(),
cameraDirection.Normalized(),
cameraUp);
activeGameObjectWithACameraComponent-
->GetComponent()-
->UpdateGlobalTransformationMatricesFromLocalTransformationMatrices();
}
bool ModuleCamera::CleanUp()
{
LOG(“Cleaning up Camera”);
return true;
}
void ModuleCamera::Save(ConfigFile& config_file) const {}
void ModuleCamara::Load(ConfigFile& config_file){}OguzhanKocak/Engine_2020<|file_sep+————————–
+Project Name Los Ojos Del Sol – Solo Mode!
+File Name Component.cpp
+Author Oguzhan Kocak
+Date March/2021
————————–
————————–
— Includes
————————–
#pragma once
#incldue "../engine/Globals.h"
#incldue "../engine/Application.h"
#incldue "../engine/jni/jsoncpp/include/json/json-forwards.h"
#incldue "../engine/jni/jsoncpp/include/json/json-valueiteratorwrapper.h"
#incldue "../engine/jni/jsoncpp/include/json/json-writer-template.h"
#incldue "../engine/jni/jsoncpp/include/json/autobufferstreambufwrapper.h"
#incldue "../engine/jni/jsoncpp/include/json/filereadstreambufwrapper.h"
#incldue "../engine/jni/jsoncpp/include/json/filewritestreambufwrapper.h"
#incldue "../engine/jni/tinyxml/TinyXML/tinyxmlparser.cpp"
——————————
— Engine Headers
——————————
#include "Globals.h"
#include "Application.hpp"
//————————————-
//– JSON Headers
//————————————-
#include "../../../jni_jsoncpp/include_jsoncpp_include_jsonjson-forwards.hpp"
//————————————-
//– JSON Headers
//————————————-
#include "../../../jni_jsoncpp/include_jsoncpp_include_jsonjson-valueiteratorwrapper.hpp"
//————————————-
//– JSON Headers
//————————————-
#include "../../../jni_jsoncpp/include_jsoncpp_include_jsonjson-writer-template.hpp"
//————————————-
//– JSON Headers
//————————————-
include "../../../jni_jsoncpplinclude_jsoncpplinclude_autobufferstreambufwrapper.hpp"
//————————————-
— Engine Headers
————————————
include "../../jnilibtinyxmlTinyXMLtinyxmlparser.cpp"
—————————————————-
— Engine Headers
—————————————————-
include "./../engine/Globals.hpp"
—————————————————-
— Application Header
—————————————————-
include "./../engine/Application.hpp"
//———————————————————————————–
— Class Declaration —
class Component : public std::enable_shared_from_this, public Saveable {
public:
virtual ~Components(void);
virtual void Start(void); // called before render loop starts
virtual void PreUpdate(void); // update components logic before rendering
virtual void Update(void); // update components logic after rendering
virtual void PostUpdate(void); // update components logic after rendering
virtual bool CleanUp(void); // called before quitting application
public:
static inline int idCounter{};
protected:
int id{};
public:
static inline std::vector<std::shared_ptr> list{};
protected:
GameObject* owner{nullptr};
public:
GameObject* GetOwner(void)const;
inline int GetId(void)const;
inline bool IsEnabled(void)const;
inline void SetEnableState(bool state);
inline bool operator==(const Component& component)const;
friend class GameObject;
protected:
inline void Init(const char* name);
private:
virtual void OnSave(JsonValue& json)const override;
virtual void OnLoad(JsonValue& json){};
protected:
std::string name{};
};
//———————————————————————————–
— Virtual Destructor —
virtual ~Components(void);
//———————————————————————————–
— Public Methods —
virtual void Start(void); // called before render loop starts
virtual void PreUpdate(void); // update components logic before rendering
virtual void Update(void); // update components logic after rendering
virtual void PostUpdate(void); // update components logic after rendering
bool CleanUp(); // called before quitting application
//———————————————————————————–
— Protected Methods —
static inline int idCounter{};
protected:
int id{};
static inline std::vector<std::shared_ptr> list{};
protected:
GameObject* owner{nullptr};
public:
inline GameObject* GetOwner();const;
inline int GetId();const;
inline bool IsEnabled();const;
inline void SetEnableState(bool state);
inline bool operator==(const Component& component)const;
friend class GameObject;
protected:
inline void Init(const char* name);
private:
virtual void OnSave(JsonValue& json)const override;
virtual virtual virtual virtual virtual virtual virtual virtual virtual virtual virtual virtual virtual virtual vritual vritual vritual vritual vritual vritual vritual vritual vritual vritual viritual vrirtual vrirtual vrirtual vrirtual vrirtual vrirtual vrirtual vrirtual vrirtual vrivial OnLoad(JsonValue& json);
protected:
std:string name{};
};// end class declaration
//———————————————————————————–
— Public Methods Implementation —
virtual ~Components():idCounter(idCounter++) {}
virtual inline GameObject* GetOwner()const {return owner;}
inline int Components:GetId()const {return id;}
inline bool Components:IsEnabled()const{return enabled;}
inline Components:SetEnableState(bool state){enabled(state);}
inline bool Components:(operator==(const Components &component))const{return this==component.get()}
//———————————————————————————–
— Protected Methods Implementation —
static inline int Components:idCounter{};
protected:
int Components:id{};
static inline std.vector<std.shared_ptr> list{};
protected:
Components.owner{nullptr};
public:
Components.GetOwner();const {
return owner;}
Components.GetId();const {
return id;}
Components.IsEnabled();const {
return enabled;}
Components.SetEnableState(bool state){enabled(state);}
bool Components:(operator==(const Components &component))const{return this==component.get()}
friend class GameObject;
protected:
Components.Init(const char* name):name(name),id(idCounter++) {
owner=nullptr;}
private:
//————————————————————————
—- Virtual Protected Methods Implementation —-
virtual protected:void OnSave(JsonValue &json)const override {
if(owner!=null){
owner.AddChild(this);}
json[“name”]=name;
if(enabled){
json[“enabled”]=true;}
if(typeid(*this)==typeid(Component)){
JsonArray array=json[“components”].array_value();
for(auto it=array.begin();it!=array.end();++it){
if(it.value().string_value()==typeid(*this).name()){}
break;}
array.push_back(typeid(*this).name());}}else{
JsonArray array=json[“components”].array_value();
for(auto it=array.begin();it!=array.end();++it){
if(it.value().string_value()==typeid(*this).name()){}
array.erase(it);
break;}
if(array.size()==0){
delete(json[“components”]);}}
if(name!=””){
json[name]=JsonValue(object)}else if(typeid(*this)==typeid(Component)){}
else if(typeid(*this)==typeid(Component)){}
else if(typeid(*this)==typeid(Component)){}
else if(typeid(*this)==typeid(Component)){};
}}
//————————————————————————
—- Private Virtual Protected Methods Implementation —-
virtual protected:void OnLoad(JsonValue &json){
}}
//————————————————————————
—- Protected Methods Implementation —-
protected:
std.string Components:name{};// end class implementation
—————————————————————————
—- Static Members Initialization —-
static inline int Components:idCounter={};
static inline std.vector<std.shared_ptr> list={};
<|file_sep+[Window][Debug##Default]
Pos=(2889,-12)
Size=(667.,697.)
Collapsed=False
[Docking][Data]
OguzhanKocak/Engine_2020<|file_sepplatformer_engine/modules/module_camera/component_camera.cpp
————————————————————————————–
—
————————————————————————————–
#define _USE_MATH_DEFINCES
————————————————————————————–
—
————————————————————————————–
#pragma once
#inclued "./../../Globals.cpp"
————————————————————————————–
—
————————————————————————————–
using namespace irrklang;
using namespace irrklang;
#pragma once
//—————————————————————————————
— Class Declaration —
class Component_Camerar : public Component {
public:
explicit Cpnonent_Camera(
explicit Cpnonent_Camera(
explicit Cpnonent_Camera(
explicit Cpnonent_Camera(
explicit Cpnonent_Camera(
explicit Cpnonent_Camera(
explicit Cpnonent_Camera(
explicit Cpnonent_Camera(
public:
public:
protected:
protected:
protected:
protected:
protected:
protected:
private :
private :
private :
private :
private :
public :
public :
public :
public :
public :
public :
public :
protected :
protected :
protected :
private :
};// end class declaration
—————————————————————————————
— Constructor / Destructor —
explicit Component_Camerar(){
componentType(Component_Type(Camera));
SetName("camera");
SetAsMainPlayerCharacter();
mathratic_constants_are_defined_using_preprocessor_directives_that_define_math_constants_like_pi_and_tau_as_float_literals_with_high_precision_values_that_can_be_used_directly_in_mathematical_expressions_without_needing_to_convert_them_into_float_literals_or_use_cast_operators_or_other_conversions_methods_this_is_useful_for_calculating_trigonometric_functions_angles_and_other_mathematical_operations_that_require_high_precision_values_and_prevent_round_off_errors_that_can_occur_when_converting_between_different_data_types_or_using_low_precision_literals_for_math_constants__default_fov_degrees_=DEFAULT_FOV_DEGREES_;
default_aspect_ratio_=DEFAULT_ASPECT_RATIO_;
default_near_plane_=DEFAULT_NEAR_PLANE_;
default_far_plane_=DEFAULT_FAR_PLANE_;}
explicit ~Cpnoment_Camerar(){}
—————————————————————————————
— Public Methods —
void Update(){
CalculateFrustumPlanes();
mathermatic_constants_are_defined_using_preprocessor_directives_that_define_math_constants_like_pi_and_tau_as_float_literals_with_high_precision_values_that_can_be_used_directly_in_mathematical_expressions_without_needing_to_convert_them_into_float_literals_or_use_cast_operators_or_other_conversions_methods_this_is_useful_for_calculating_trigonometric_functions_angles_and_other_mathematical_operations_that_require_high_precision_values_and_prevent_round_off_errors_that_can_occur_when_converting_between_different_data_types_or_using_low_precision_literals_for_math_constants__fov_radian_angle_per_second=fMath_ConversionFactor_Per