A lot of changes

This commit is contained in:
Vladislav Khorev 2024-06-05 21:19:20 +03:00
parent 5720f8322b
commit ef92c70ae8
17 changed files with 12289 additions and 42 deletions

View File

@ -23,17 +23,20 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_nosound|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -94,17 +94,20 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_nosound|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -135,8 +138,8 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\openal\OpenAL11_windows_sdk;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;$(LibsPath)\DirectXsdk\Include;$(LibsPath)\lpng1510</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NOSOUND;TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..;C:\Boost\include\boost-1_84;..\..\lpng1510</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

12146
gl/glext.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,9 @@ protected:
float GlobalShadowAreaHalfSize;
cardinal BkgTexID;
std::string BkgShaderName;
void CalcCamPosVec();
virtual void DrawQuad(const T2DQuad& quad) = 0;
@ -79,6 +82,11 @@ public:
void BeginDrawToDepthBufferLocal(std::string& localBufferName);
void EndDrawToDepthBuffer();
void SetBackgroundCubemap(cardinal bkgTex) { BkgTexID = bkgTex; }
void SetBackgroundShader(const std::string& shaderName) { BkgShaderName = shaderName; }
void DrawBackground();
};
} //namespace SE

View File

@ -1,7 +1,7 @@
#ifndef SCRIPT_MANAGER_H_INCLUDED
#define SCRIPT_MANAGER_H_INCLUDED
#include "sqplus.h"
//#include "sqplus.h"
#include <iostream>
#include <string>
@ -44,22 +44,23 @@ public:
};
class TScriptManager : public TSerializeInterface
{
protected:
HSQUIRRELVM virtualMachine;
//HSQUIRRELVM virtualMachine;
std::map<std::string, TScriptInfo> FuncInfoMap;
template<typename T1,typename T2>
void RegisterFunc(T1& object, T2 method, const std::string& funcName)
{
SqPlus::RegisterGlobal(virtualMachine, object, method, _SC(funcName.c_str()));
//SqPlus::RegisterGlobal(virtualMachine, object, method, _SC(funcName.c_str()));
}
template<typename T>
void RegisterFunc(T globalFunc, const std::string& funcName)
{
SqPlus::RegisterGlobal(virtualMachine, globalFunc, _SC(funcName.c_str()));
//SqPlus::RegisterGlobal(virtualMachine, globalFunc, _SC(funcName.c_str()));
}
public:
@ -103,9 +104,9 @@ public:
void SQ_Print(const SQChar *inString);
void SQ_PrintWidgetList();
void SQ_MoveWidget(const SQChar *widgetName, float x, float y);
//void SQ_Print(const SQChar *inString);
//void SQ_PrintWidgetList();
//void SQ_MoveWidget(const SQChar *widgetName, float x, float y);
//void SQ_PrintTextureList();
//void SQ_PrintAnimationList();

View File

@ -41,7 +41,7 @@ public:
}
template<typename TYPENAME>
boost::signal<void(const TYPENAME&)>& GetSignal(const std::string& dictName, const std::string& valueName)
boost::signals2::signal<void(const TYPENAME&)>& GetSignal(const std::string& dictName, const std::string& valueName)
{
return boost::get<std::shared_ptr<TBindableVar<TYPENAME>>>(GetSmartValue(dictName, valueName))->OnVarChanged;
}

View File

@ -1,7 +1,7 @@
#ifndef BINDABLE_VAR_H_INCLUDED
#define BINDABLE_VAR_H_INCLUDED
#include "boost/signal.hpp"
#include "boost/signals2.hpp"
#include "boost/variant.hpp"
namespace SE
@ -17,7 +17,7 @@ protected:
public:
boost::signal<void(const TYPENAME&)> OnVarChanged;
boost::signals2::signal<void(const TYPENAME&)> OnVarChanged;
TBindableVar()
{

View File

@ -14,7 +14,7 @@ This code combines additional routines (such as console/log, exceptions, math ut
#include "boost/asio.hpp"
#include "boost/date_time/posix_time/posix_time.hpp"
#include "boost/signal.hpp"
#include "boost/signals2.hpp"
#include "include/Utils/Console/Console.h"

View File

@ -32,8 +32,10 @@ bool TLiteModelResource::LoadModel(boost::shared_array<byte> filePointer, cardin
int normtexnamelen = *reinterpret_cast<word*>(&filePointer[78]+texnamelen);
Normtexname = std::string(reinterpret_cast<char*>(&filePointer[80]+texnamelen), reinterpret_cast<char*>(&filePointer[80]+texnamelen) + normtexnamelen);
if (Texname != "")
{
ResourceManager->TexList.AddTextureDirectly((PathToResource + std::string(Texname)));
}
if (Normtexname != "")
{
ResourceManager->TexList.AddTextureDirectly((PathToResource + std::string(Normtexname)));

View File

@ -805,6 +805,76 @@ void TSalmonRendererInterface::EndDrawToDepthBuffer()
SetPerspectiveFullScreenViewport();
}
void TSalmonRendererInterface::DrawBackground()
{
if (BkgTexID != 0)
{
//ResourceManager->ShaderManager.PushShader(BkgShaderName);
this->PushShader(BkgShaderName);
//if (BkgShaderName != "")
// ResourceManager->ShaderManager.SetCurrentShader(BkgShaderName);
glPushMatrix();
glLoadIdentity();
glRotatef(CamPhi * 180.0f / pi, 1.0f, 0.0f, 0.0f);
glRotatef(CamAlpha * 180.0f / pi, 0.0f, 1.0f, 0.0f);
glBindTexture(GL_TEXTURE_CUBE_MAP, BkgTexID);
//x
glBegin(GL_QUADS);
glVertex3f(-10.0f, -10.0f, -10.0f);
glVertex3f(-10.0f, 10.0f, -10.0f);
glVertex3f(-10.0f, 10.0f, 10.0f);
glVertex3f(-10.0f, -10.0f, 10.0f);
glEnd();
glBegin(GL_QUADS);
glVertex3f(10.0f, -10.0f, -10.0f);
glVertex3f(10.0f, 10.0f, -10.0f);
glVertex3f(10.0f, 10.0f, 10.0f);
glVertex3f(10.0f, -10.0f, 10.0f);
glEnd();
//y
glBegin(GL_QUADS);
glVertex3f(-10.0f, 10.0f, -10.0f);
glVertex3f(10.0f, 10.0f, -10.0f);
glVertex3f(10.0f, 10.0f, 10.0f);
glVertex3f(-10.0f, 10.0f, 10.0f);
glEnd();
glBegin(GL_QUADS);
glVertex3f(-10.0f, -10.0f, -10.0f);
glVertex3f(10.0f, -10.0f, -10.0f);
glVertex3f(10.0f, -10.0f, 10.0f);
glVertex3f(-10.0f, -10.0f, 10.0f);
glEnd();
//z
glBegin(GL_QUADS);
glVertex3f(10.0f, -10.0f, 10.0f);
glVertex3f(10.0f, 10.0f, 10.0f);
glVertex3f(-10.0f, 10.0f, 10.0f);
glVertex3f(-10.0f, -10.0f, 10.0f);
glEnd();
glBegin(GL_QUADS);
glVertex3f(10.0f, -10.0f, -10.0f);
glVertex3f(10.0f, 10.0f, -10.0f);
glVertex3f(-10.0f, 10.0f, -10.0f);
glVertex3f(-10.0f, -10.0f, -10.0f);
glEnd();
glClear(GL_DEPTH_BUFFER_BIT);
glPopMatrix();
PopShader();
}
}
} //namespace SE

View File

@ -34,8 +34,8 @@ void TApplicationAncestor::OuterDeinit()
void TApplicationAncestor::OuterDraw()
{
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
//glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glActiveTexture(GL_TEXTURE0);
RenderUniform1i("Texture", 0);
@ -43,16 +43,16 @@ void TApplicationAncestor::OuterDraw()
InnerDraw();
glDisable(GL_DEPTH_TEST);
Renderer->PushShader("DefaultShader");
//glDisable(GL_DEPTH_TEST);
/*Renderer->PushShader("DefaultShader");
if (IsConsoleOut)
{
Console->Draw();
}
Renderer->PopShader();
glEnable(GL_DEPTH_TEST);
Renderer->PopShader();*/
//glEnable(GL_DEPTH_TEST);
}
void TApplicationAncestor::OuterUpdate(cardinal timer)

View File

@ -10,9 +10,9 @@ std::vector<TFunctionBinderInterface*> TFunctionBinderInterface::BinderList;
TScriptManager::TScriptManager()
{
SquirrelVM::Init();
//SquirrelVM::Init();
virtualMachine = SquirrelVM::GetVMPtr();
//virtualMachine = SquirrelVM::GetVMPtr();
//SqPlus::RegisterGlobal(virtualMachine, SQ_Print, _SC("Print"));
//SqPlus::RegisterGlobal(virtualMachine, SQ_Print, _SC("p"));
@ -58,12 +58,12 @@ TScriptManager::TScriptManager()
TScriptManager::~TScriptManager()
{
*Console<<"Script manager shutdown";
SquirrelVM::Shutdown();
//SquirrelVM::Shutdown();
}
void TScriptManager::RunScript(const std::string& scriptCode)
{
try
/*try
{
SquirrelObject m = SquirrelVM::CompileBuffer(_T(scriptCode.c_str()));
@ -72,7 +72,7 @@ void TScriptManager::RunScript(const std::string& scriptCode)
catch (SquirrelError)
{
*Console<<"Script failed to run";
}
}*/
}
@ -80,7 +80,7 @@ void TScriptManager::RunScript(const std::string& scriptCode)
void TScriptManager::BindBasicFunctions()
{
//Hack =D
static bool alreadyBind = false;
/*static bool alreadyBind = false;
if (!alreadyBind)
{
@ -102,7 +102,7 @@ void TScriptManager::BindBasicFunctions()
alreadyBind = true;
}
*/
@ -171,10 +171,11 @@ void TScriptManager::Serialize(boost::property_tree::ptree& propertyTree)
//============= Typical commands ==============
//=============================================
/*
void SQ_Print(const SQChar *inString)
{
Console->PrintImmediate(std::string(inString));
}
}*/
/*
void SQ_PrintWidgetList()

View File

@ -1,4 +1,5 @@
#include "include/Engine.h"
#define TARGET_WIN32
namespace SE
{
@ -132,6 +133,7 @@ void TSimpleLandClass::CreateVBO()
void TSimpleLandClass::FreeVBO()
{
#ifdef TARGET_WIN32
glDeleteBuffers(1, &VertexBuffer);
glDeleteBuffers(1, &NormBuffer);
glDeleteBuffers(1, &TangentBuffer);
@ -381,23 +383,27 @@ void TSimpleLandClass::DrawImmediate()
float tx1 = float(j+1)/(Width-1);
float ty1 = float(i+1)/(Height-1);
glBegin(GL_TRIANGLES);
glNormal3fv(VertexMatrix[k].norm.v);
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k].tangent.v);
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k].binorm.v);
glTexCoord2f(tx0,ty0);
//glTexCoord2f(tx0,ty0);
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty0 }[0]);
glVertex3fv(VertexMatrix[k].pos.v);
glNormal3fv(VertexMatrix[k_right].norm.v);
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right].tangent.v);
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right].binorm.v);
glTexCoord2f(tx1,ty0);
//glTexCoord2f(tx1,ty0);
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty0 }[0]);
glVertex3fv(VertexMatrix[k_right].pos.v);
glNormal3fv(VertexMatrix[k_up].norm.v);
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_up].tangent.v);
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_up].binorm.v);
glTexCoord2f(tx0,ty1);
//glTexCoord2f(tx0,ty1);
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty1 }[0]);
glVertex3fv(VertexMatrix[k_up].pos.v);
glEnd();
@ -405,19 +411,22 @@ void TSimpleLandClass::DrawImmediate()
glNormal3fv(VertexMatrix[k_right_up].norm.v);
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right_up].tangent.v);
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right_up].binorm.v);
glTexCoord2f(tx1,ty1);
//glTexCoord2f(tx1,ty1);
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty1 }[0]);
glVertex3fv(VertexMatrix[k_right_up].pos.v);
glNormal3fv(VertexMatrix[k_up].norm.v);
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_up].tangent.v);
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_up].binorm.v);
glTexCoord2f(tx0,ty1);
//glTexCoord2f(tx0,ty1);
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty1 }[0]);
glVertex3fv(VertexMatrix[k_up].pos.v);
glNormal3fv(VertexMatrix[k_right].norm.v);
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right].tangent.v);
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right].binorm.v);
glTexCoord2f(tx1,ty0);
//glTexCoord2f(tx1,ty0);
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty0 }[0]);
glVertex3fv(VertexMatrix[k_right].pos.v);
glEnd();

View File

@ -86,7 +86,6 @@ ov_callbacks OggCallbacks = {
};
#endif //NOSOUND
} //namespace SE
#endif //NOSOUND

View File

@ -1016,7 +1016,7 @@ cardinal TOggMusicStream::GetSamplesPerSec()
}
#endif //NOSOUND
} //namespace SE
#endif //NOSOUND

View File

@ -3,7 +3,7 @@
#include "include/Utils/Utils.h"
#include "include/Engine.h"
#include "boost/gil/gil_all.hpp"
#include "boost/bind.hpp"
#include "boost/gil/extension/numeric/sampler.hpp"
#include "boost/gil/extension/numeric/resample.hpp"
@ -18,6 +18,7 @@ TTextureListClass::TTextureListClass()
using namespace std;
CreateFunctionMap[".bmp"] = boost::bind(&TTextureListClass::CreateTexDataFromBmp24, this, _1, _2);
CreateFunctionMap[".bmp32"] = boost::bind(&TTextureListClass::CreateTexDataFromBmp32, this, _1, _2);
CreateFunctionMap[".png"] = boost::bind(&TTextureListClass::CreateTexDataFromPng, this, _1, _2);