Improving Asset managment
@ -5,18 +5,21 @@
|
||||
|
||||
#include "Deer/Path.h"
|
||||
|
||||
#define DEER_SCENE_PATH "scenes"
|
||||
#define DEER_SCRIPT_PATH "scripts"
|
||||
#define DEER_SHADER_PATH "shaders"
|
||||
#define DEER_VOXEL_PATH "voxels"
|
||||
#define DEER_VOXEL_DATA_PATH "voxels/data"
|
||||
#define DEER_VOXEL_ASPECT_PATH "voxels/aspect"
|
||||
#define DEER_VOXEL_TEXTURE_PATH "voxels/textures"
|
||||
#define DEER_VOXEL_SHADER_PATH "voxels/shaders"
|
||||
#define DEER_ASSET_PATH "Assets"
|
||||
#define DEER_MESH_PATH "Assets/Meshes"
|
||||
#define DEER_SHADER_PATH "Assets/Shaders"
|
||||
#define DEER_SCENE_PATH "Assets/Scenes"
|
||||
#define DEER_SCRIPT_PATH "Assets/Scripts"
|
||||
|
||||
#define DEER_VOXEL_PATH "Assets/Voxels"
|
||||
#define DEER_VOXEL_DATA_PATH "Assets/Voxels/Data"
|
||||
#define DEER_VOXEL_ASPECT_PATH "Assets/Voxels/Visuals"
|
||||
#define DEER_VOXEL_TEXTURE_PATH "Assets/Voxels/Textures"
|
||||
#define DEER_VOXEL_SHADER_PATH "Assets/Voxels/Shaders"
|
||||
|
||||
#define DEER_EDITOR_PATH "Editor"
|
||||
#define DEER_EDITOR_PANEL_PATH "Editor/DockPanelModules"
|
||||
#define DEER_EDITOR_SERVICE_PATH "Editor/ScriptServiceModules"
|
||||
#define DEER_MESH_PATH "meshes"
|
||||
#define DEER_EDITOR_PANEL_PATH "Editor/Panels"
|
||||
#define DEER_EDITOR_SERVICE_PATH "Editor/Services"
|
||||
|
||||
#define DEER_MESH_EXTENSION ".dmesh"
|
||||
#define DEER_SHADER_EXTENSION ".glsl"
|
||||
@ -38,15 +41,18 @@ namespace Deer {
|
||||
void clearCache();
|
||||
|
||||
// Rerturns a directory data with the elements relative to the id
|
||||
const DirectoryData& getDirData(const Path& id, const Path& dir, const char* extension);
|
||||
const DirectoryData& getDirData(const Path& id, const Path& dir,
|
||||
const char* extension);
|
||||
|
||||
// TODO: Add safety
|
||||
// Returns the data of the specified file path
|
||||
bool loadFileData(const Path& id, const Path& name, uint8_t** data, uint32_t* size);
|
||||
bool loadFileData(const Path& id, const Path& name, uint8_t** data,
|
||||
uint32_t* size);
|
||||
// Returns the data of the specified file path avoiding extension
|
||||
bool loadGlobalFileData(const Path& id, const Path& name, uint8_t** data, uint32_t* size);
|
||||
bool loadGlobalFileData(const Path& id, const Path& name,
|
||||
uint8_t** data, uint32_t* size);
|
||||
void freeFileData(uint8_t*);
|
||||
|
||||
|
||||
void createFolder(const Path& path);
|
||||
|
||||
void saveFile(const Path&, uint8_t* data, uint32_t size);
|
||||
@ -60,5 +66,5 @@ namespace Deer {
|
||||
// Refactor----
|
||||
|
||||
extern Path rootPath;
|
||||
} // namespace DataStore
|
||||
} // namespace Deer
|
||||
} // namespace DataStore
|
||||
} // namespace Deer
|
@ -2,200 +2,210 @@
|
||||
#include "Deer/Log.h"
|
||||
#include "Deer/Path.h"
|
||||
|
||||
#include "cereal/archives/portable_binary.hpp"
|
||||
#include "cereal/cereal.hpp"
|
||||
#include "cereal/types/unordered_map.hpp"
|
||||
#include "cereal/archives/portable_binary.hpp"
|
||||
|
||||
#include "Deer/DataStore/DataStructure.h"
|
||||
#include "Deer/DataStore/DataStructureSerialization.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <streambuf>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace Deer {
|
||||
namespace DataStore {
|
||||
Path rootPath;
|
||||
std::unordered_map<std::string ,DirectoryData> dirData_cache;
|
||||
}
|
||||
namespace DataStore {
|
||||
Path rootPath;
|
||||
std::unordered_map<std::string, DirectoryData> dirData_cache;
|
||||
} // namespace DataStore
|
||||
|
||||
const DirectoryData& DataStore::getDirData(const Path& id, const Path& subDir, const char* extension) {
|
||||
std::string dirId = std::string(id) + "&" + std::string(subDir) + "&" + std::string(extension);
|
||||
if (dirData_cache.contains(dirId)) {
|
||||
return dirData_cache[dirId];
|
||||
}
|
||||
const DirectoryData& DataStore::getDirData(const Path& id,
|
||||
const Path& subDir,
|
||||
const char* extension) {
|
||||
std::string dirId = std::string(id) + "&" + std::string(subDir) + "&" +
|
||||
std::string(extension);
|
||||
if (dirData_cache.contains(dirId)) {
|
||||
return dirData_cache[dirId];
|
||||
}
|
||||
|
||||
Path idPath = rootPath / id;
|
||||
Path idPath = rootPath / id;
|
||||
|
||||
Path searchPath = idPath / subDir;
|
||||
Path searchPath = idPath / subDir;
|
||||
|
||||
DirectoryData& dirData = dirData_cache[dirId];
|
||||
for (const auto& entry : std::filesystem::directory_iterator(searchPath)) {
|
||||
if (entry.is_directory())
|
||||
dirData.dirs.push_back(entry.path().lexically_relative(idPath));
|
||||
else if (entry.path().extension() == extension) {
|
||||
Path ent = entry.path().lexically_relative(idPath);
|
||||
dirData.elements.push_back(ent.parent_path() / ent.stem());
|
||||
}
|
||||
}
|
||||
DirectoryData& dirData = dirData_cache[dirId];
|
||||
for (const auto& entry :
|
||||
std::filesystem::directory_iterator(searchPath)) {
|
||||
if (entry.is_directory())
|
||||
dirData.dirs.push_back(entry.path().lexically_relative(idPath));
|
||||
else if (entry.path().extension() == extension) {
|
||||
Path ent = entry.path().lexically_relative(idPath);
|
||||
dirData.elements.push_back(ent.parent_path() / ent.stem());
|
||||
}
|
||||
}
|
||||
|
||||
return dirData;
|
||||
}
|
||||
return dirData;
|
||||
}
|
||||
|
||||
bool DataStore::loadFileData(const Path& id, const Path& name, uint8_t** data, uint32_t* size) {
|
||||
Path filePath = rootPath / id / name;
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary);
|
||||
bool DataStore::loadFileData(const Path& id, const Path& name,
|
||||
uint8_t** data, uint32_t* size) {
|
||||
Path filePath = rootPath / id / name;
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary);
|
||||
|
||||
if (!file) {
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
if (!file) {
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
*data = new uint8_t[*size];
|
||||
*data = new uint8_t[*size];
|
||||
|
||||
if (!file.read(reinterpret_cast<char*>(*data), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}", filePath.generic_string().c_str());
|
||||
delete[] *data;
|
||||
return false;
|
||||
}
|
||||
if (!file.read(reinterpret_cast<char*>(*data), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}",
|
||||
filePath.generic_string().c_str());
|
||||
delete[] *data;
|
||||
return false;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DataStore::loadGlobalFileData(const Path& id, const Path& name, uint8_t** data, uint32_t* size) {
|
||||
Path filePath = rootPath / id;
|
||||
for (auto& f : std::filesystem::recursive_directory_iterator(filePath)) {
|
||||
if (f.path().stem() == name) {
|
||||
std::ifstream file(f.path(), std::ios::in | std::ios::binary);
|
||||
bool DataStore::loadGlobalFileData(const Path& id, const Path& name,
|
||||
uint8_t** data, uint32_t* size) {
|
||||
Path filePath = rootPath / id;
|
||||
for (auto& f :
|
||||
std::filesystem::recursive_directory_iterator(filePath)) {
|
||||
if (f.path().stem() == name) {
|
||||
std::ifstream file(f.path(), std::ios::in | std::ios::binary);
|
||||
|
||||
if (!file) {
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
if (!file) {
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
*data = new uint8_t[*size];
|
||||
*data = new uint8_t[*size];
|
||||
|
||||
if (!file.read(reinterpret_cast<char*>(*data), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}", filePath.generic_string().c_str());
|
||||
delete[] *data;
|
||||
return false;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!file.read(reinterpret_cast<char*>(*data), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}",
|
||||
filePath.generic_string().c_str());
|
||||
delete[] *data;
|
||||
return false;
|
||||
}
|
||||
|
||||
DEER_CORE_ERROR("File {0} not found", filePath.string().c_str());
|
||||
return false;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::freeFileData(uint8_t* data) {
|
||||
delete[] data;
|
||||
}
|
||||
DEER_CORE_ERROR("File {0} not found", filePath.string().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void DataStore::deleteFile(const Path& path) {
|
||||
Path filePath = rootPath / toLowerCasePath(path);
|
||||
std::filesystem::remove(filePath);
|
||||
}
|
||||
void DataStore::freeFileData(uint8_t* data) { delete[] data; }
|
||||
|
||||
uint8_t* DataStore::readFile(const Path& path, uint32_t* size) {
|
||||
Path filePath = rootPath / toLowerCasePath(path);
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary);
|
||||
void DataStore::deleteFile(const Path& path) {
|
||||
Path filePath = rootPath / toLowerCasePath(path);
|
||||
std::filesystem::remove(filePath);
|
||||
}
|
||||
|
||||
if (!file) {
|
||||
file.close();
|
||||
return nullptr;
|
||||
}
|
||||
uint8_t* DataStore::readFile(const Path& path, uint32_t* size) {
|
||||
Path filePath = rootPath / path;
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary);
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
if (!file) {
|
||||
file.close();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint8_t* buffer = new uint8_t[*size];
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
if (!file.read(reinterpret_cast<char*>(buffer), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}", filePath.generic_string().c_str());
|
||||
delete[] buffer;
|
||||
return nullptr;
|
||||
}
|
||||
uint8_t* buffer = new uint8_t[*size];
|
||||
|
||||
file.close();
|
||||
return buffer;
|
||||
}
|
||||
if (!file.read(reinterpret_cast<char*>(buffer), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}",
|
||||
filePath.generic_string().c_str());
|
||||
delete[] buffer;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DataStore::saveFile(const Path& path, uint8_t* data, uint32_t size) {
|
||||
Path filePath = rootPath / toLowerCasePath(path);
|
||||
std::filesystem::create_directories(filePath.parent_path());
|
||||
file.close();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::ofstream file(filePath, std::ios::out | std::ios::binary);
|
||||
void DataStore::saveFile(const Path& path, uint8_t* data, uint32_t size) {
|
||||
Path filePath = rootPath / toLowerCasePath(path);
|
||||
std::filesystem::create_directories(filePath.parent_path());
|
||||
|
||||
DEER_CORE_ASSERT(file, "Error when writing file {0}", filePath.generic_string().c_str());
|
||||
std::ofstream file(filePath, std::ios::out | std::ios::binary);
|
||||
|
||||
file.write(reinterpret_cast<const char*>(data), size);
|
||||
}
|
||||
DEER_CORE_ASSERT(file, "Error when writing file {0}",
|
||||
filePath.generic_string().c_str());
|
||||
|
||||
void DataStore::compressFiles(std::vector<Path> files, const Path& path) {
|
||||
std::unordered_map<Path, DataStructure> dataStructure;
|
||||
std::vector<uint8_t> combinedData;
|
||||
|
||||
for (const Path& inputPath : files) {
|
||||
uint32_t fileSize = 0;
|
||||
uint8_t* fileData = readFile(inputPath, &fileSize);
|
||||
file.write(reinterpret_cast<const char*>(data), size);
|
||||
}
|
||||
|
||||
uint32_t start = combinedData.size();
|
||||
void DataStore::compressFiles(std::vector<Path> files, const Path& path) {
|
||||
std::unordered_map<Path, DataStructure> dataStructure;
|
||||
std::vector<uint8_t> combinedData;
|
||||
|
||||
combinedData.insert(combinedData.end(), fileData, fileData + fileSize);
|
||||
dataStructure[inputPath] = DataStructure{
|
||||
.dataPath = inputPath,
|
||||
.dataStart = start,
|
||||
.dataSize = fileSize
|
||||
};
|
||||
for (const Path& inputPath : files) {
|
||||
uint32_t fileSize = 0;
|
||||
uint8_t* fileData = readFile(inputPath, &fileSize);
|
||||
|
||||
delete[] fileData;
|
||||
}
|
||||
uint32_t start = combinedData.size();
|
||||
|
||||
Path compressedPath = path;
|
||||
compressedPath += ".deer";
|
||||
Path metaPath = path;
|
||||
metaPath += ".deer.meta";
|
||||
combinedData.insert(combinedData.end(), fileData,
|
||||
fileData + fileSize);
|
||||
dataStructure[inputPath] = DataStructure{.dataPath = inputPath,
|
||||
.dataStart = start,
|
||||
.dataSize = fileSize};
|
||||
|
||||
std::stringstream buffer;
|
||||
{
|
||||
cereal::PortableBinaryOutputArchive archive(buffer);
|
||||
archive(dataStructure);
|
||||
}
|
||||
delete[] fileData;
|
||||
}
|
||||
|
||||
saveFile(compressedPath, combinedData.data(), combinedData.size());
|
||||
saveFile(metaPath, (uint8_t*)buffer.str().c_str(), buffer.str().size());
|
||||
}
|
||||
Path compressedPath = path;
|
||||
compressedPath += ".deer";
|
||||
Path metaPath = path;
|
||||
metaPath += ".deer.meta";
|
||||
|
||||
std::vector<Path> DataStore::getFiles(const Path& path, const std::string& extension) {
|
||||
std::vector<Path> files;
|
||||
Path lookPath = rootPath / path;
|
||||
std::stringstream buffer;
|
||||
{
|
||||
cereal::PortableBinaryOutputArchive archive(buffer);
|
||||
archive(dataStructure);
|
||||
}
|
||||
|
||||
for (const auto& entry : std::filesystem::recursive_directory_iterator(lookPath)) {
|
||||
if (std::filesystem::is_regular_file(entry) && entry.path().extension() == extension) {
|
||||
files.push_back(entry.path().lexically_relative(rootPath));
|
||||
}
|
||||
}
|
||||
saveFile(compressedPath, combinedData.data(), combinedData.size());
|
||||
saveFile(metaPath, (uint8_t*)buffer.str().c_str(), buffer.str().size());
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
std::vector<Path> DataStore::getFiles(const Path& path,
|
||||
const std::string& extension) {
|
||||
std::vector<Path> files;
|
||||
Path lookPath = rootPath / path;
|
||||
|
||||
void DataStore::createFolder(const Path& path) {
|
||||
std::filesystem::create_directories(path);
|
||||
}
|
||||
}
|
||||
for (const auto& entry :
|
||||
std::filesystem::recursive_directory_iterator(lookPath)) {
|
||||
if (std::filesystem::is_regular_file(entry) &&
|
||||
entry.path().extension() == extension) {
|
||||
files.push_back(entry.path().lexically_relative(rootPath));
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void DataStore::createFolder(const Path& path) {
|
||||
std::filesystem::create_directories(path);
|
||||
}
|
||||
} // namespace Deer
|
||||
|
@ -13,10 +13,11 @@ namespace Deer {
|
||||
namespace DataStore {
|
||||
std::vector<VoxelInfo> voxelsInfo;
|
||||
std::unordered_map<std::string, uint32_t> blockIDMap;
|
||||
} // namespace DataStore
|
||||
} // namespace DataStore
|
||||
|
||||
int32_t DataStore::getVoxelID(const std::string& name) {
|
||||
if (blockIDMap.contains(name)) return blockIDMap[name];
|
||||
if (blockIDMap.contains(name))
|
||||
return blockIDMap[name];
|
||||
DEER_CORE_WARN("Voxel Info {0} Not Found!", name.c_str());
|
||||
return -1;
|
||||
}
|
||||
@ -35,7 +36,6 @@ namespace Deer {
|
||||
voxelsData = DataStore::getFiles(DEER_VOXEL_DATA_PATH, ".voxel");
|
||||
|
||||
DEER_CORE_TRACE("Loading voxels");
|
||||
//DEER_CORE_TRACE(" default - air");
|
||||
for (Path& voxel : voxelsData) {
|
||||
VoxelInfo voxelData;
|
||||
|
||||
@ -61,9 +61,9 @@ namespace Deer {
|
||||
voxelData.name.c_str());
|
||||
continue;
|
||||
}
|
||||
//DEER_CORE_TRACE(" {0} - {1}",
|
||||
// voxel.filename().generic_string().c_str(),
|
||||
// voxelData.name);
|
||||
// DEER_CORE_TRACE(" {0} - {1}",
|
||||
// voxel.filename().generic_string().c_str(),
|
||||
// voxelData.name);
|
||||
|
||||
uint32_t id = voxelsInfo.size();
|
||||
|
||||
@ -86,4 +86,4 @@ namespace Deer {
|
||||
DataStore::saveFile(Path(DEER_VOXEL_PATH) / "voxel.example",
|
||||
(uint8_t*)(data.str().c_str()), data.str().size());
|
||||
}
|
||||
} // namespace Deer
|
||||
} // namespace Deer
|
@ -9,44 +9,44 @@ Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][Terrain Editor]
|
||||
Pos=827,24
|
||||
Size=453,361
|
||||
Pos=925,24
|
||||
Size=355,413
|
||||
Collapsed=0
|
||||
DockId=0x00000006,0
|
||||
|
||||
[Window][Viewport]
|
||||
Pos=440,24
|
||||
Size=385,361
|
||||
Pos=309,24
|
||||
Size=614,413
|
||||
Collapsed=0
|
||||
DockId=0x00000005,0
|
||||
|
||||
[Window][ViewportPannel]
|
||||
Pos=440,24
|
||||
Size=385,361
|
||||
Pos=309,24
|
||||
Size=614,413
|
||||
Collapsed=0
|
||||
DockId=0x00000005,1
|
||||
|
||||
[Window][ShaderExplorer]
|
||||
Pos=0,387
|
||||
Size=1280,333
|
||||
Pos=0,439
|
||||
Size=1280,281
|
||||
Collapsed=0
|
||||
DockId=0x00000004,1
|
||||
|
||||
[Window][TreePannel]
|
||||
Pos=0,24
|
||||
Size=438,361
|
||||
Size=307,413
|
||||
Collapsed=0
|
||||
DockId=0x00000001,0
|
||||
|
||||
[Window][MeshExplorer]
|
||||
Pos=0,387
|
||||
Size=1280,333
|
||||
Pos=0,439
|
||||
Size=1280,281
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
[Window][PropertiesPannel]
|
||||
Pos=827,24
|
||||
Size=453,361
|
||||
Pos=925,24
|
||||
Size=355,413
|
||||
Collapsed=0
|
||||
DockId=0x00000006,1
|
||||
|
||||
@ -62,22 +62,28 @@ Size=40,64
|
||||
Collapsed=0
|
||||
|
||||
[Window][Rename entity]
|
||||
Pos=1228,651
|
||||
Size=104,68
|
||||
Pos=398,235
|
||||
Size=643,74
|
||||
Collapsed=0
|
||||
|
||||
[Window][Test]
|
||||
Pos=440,24
|
||||
Size=385,361
|
||||
Pos=423,24
|
||||
Size=1682,1012
|
||||
Collapsed=0
|
||||
DockId=0x00000005,2
|
||||
|
||||
[Window][AssetExplorer]
|
||||
Pos=0,439
|
||||
Size=1280,281
|
||||
Collapsed=0
|
||||
DockId=0x00000004,2
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1280,696 Split=Y Selected=0x34A4C10F
|
||||
DockNode ID=0x00000003 Parent=0xA1672E74 SizeRef=1280,1012 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=438,696 Selected=0xE45B9F93
|
||||
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=2120,696 Split=X Selected=0x34A4C10F
|
||||
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=1665,454 CentralNode=1 Selected=0x34A4C10F
|
||||
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=453,454 Selected=0xA35A27E3
|
||||
DockNode ID=0x00000004 Parent=0xA1672E74 SizeRef=1280,333 Selected=0xD962995A
|
||||
DockNode ID=0x00000003 Parent=0xA1672E74 SizeRef=1280,413 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=307,696 Selected=0xE45B9F93
|
||||
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=971,696 Split=X Selected=0x34A4C10F
|
||||
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=614,454 CentralNode=1 Selected=0x34A4C10F
|
||||
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=355,454 Selected=0xA35A27E3
|
||||
DockNode ID=0x00000004 Parent=0xA1672E74 SizeRef=1280,281 Selected=0x21191D0B
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
#include "DeerStudio.h"
|
||||
|
||||
#include "Deer/Path.h"
|
||||
#include "Deer/VoxelWorld.h"
|
||||
#include "Deer/DataStore.h"
|
||||
#include "Deer/Voxel.h"
|
||||
#include "Deer/Path.h"
|
||||
#include "Deer/Scene.h"
|
||||
#include "Deer/Voxel.h"
|
||||
#include "Deer/VoxelWorld.h"
|
||||
|
||||
#include "DeerRender/Application.h"
|
||||
#include "DeerRender/GizmoRenderer.h"
|
||||
|
||||
#include "DeerStudio/EditorEngine.h"
|
||||
#include "DeerStudio/Editor/Viewport.h"
|
||||
#include "DeerStudio/Editor/Terrain/TerrainEditor.h"
|
||||
#include "DeerStudio/Editor/Viewport.h"
|
||||
#include "DeerStudio/EditorEngine.h"
|
||||
|
||||
// TMP
|
||||
#include "DeerStudio/Editor/Icons.h"
|
||||
@ -19,20 +19,18 @@
|
||||
#include "DeerStudio/Style.h"
|
||||
// TMP
|
||||
|
||||
int main(int, char**) {
|
||||
Deer::DeerStudio::main();
|
||||
}
|
||||
int main(int argc, char** args) { Deer::DeerStudio::main(); }
|
||||
|
||||
namespace Deer {
|
||||
namespace DeerStudio {
|
||||
namespace DeerStudio {
|
||||
void main() {
|
||||
|
||||
Log::init();
|
||||
Application::initWindow();
|
||||
|
||||
Application::initWindow();
|
||||
|
||||
Path projectPath = Application::getWindow().folderDialog(nullptr);
|
||||
if (projectPath.empty()) return;
|
||||
|
||||
if (projectPath.empty())
|
||||
return;
|
||||
|
||||
DataStore::rootPath = projectPath;
|
||||
|
||||
DataStore::loadVoxelsData();
|
||||
@ -48,12 +46,12 @@ namespace Deer {
|
||||
SetupImGuiStyle();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 20));
|
||||
|
||||
|
||||
Application::setTickCallback(DeerStudio::onUpdate);
|
||||
Application::setRenderCallback(DeerStudio::onRender);
|
||||
Application::setEventCallback(DeerStudio::onEvent);
|
||||
|
||||
Application::run();
|
||||
Application::run();
|
||||
|
||||
EditorEngine::deinitialize();
|
||||
|
||||
@ -61,72 +59,73 @@ namespace Deer {
|
||||
Log::shutdown();
|
||||
}
|
||||
|
||||
void onUpdate() {
|
||||
if (VoxelWorld::isInitialized())
|
||||
VoxelWorld::bakeNextChunk();
|
||||
}
|
||||
void onUpdate() {
|
||||
if (VoxelWorld::isInitialized())
|
||||
VoxelWorld::bakeNextChunk();
|
||||
}
|
||||
|
||||
void onRender() {
|
||||
static bool opt_fullscreen = true;
|
||||
static bool opt_padding = false;
|
||||
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;
|
||||
void onRender() {
|
||||
static bool opt_fullscreen = true;
|
||||
static bool opt_padding = false;
|
||||
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;
|
||||
|
||||
ImGuiWindowFlags window_flags =
|
||||
ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
|
||||
ImGuiWindowFlags window_flags =
|
||||
ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
|
||||
|
||||
{
|
||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||
ImGui::SetNextWindowPos(viewport->WorkPos);
|
||||
ImGui::SetNextWindowSize(viewport->WorkSize);
|
||||
ImGui::SetNextWindowViewport(viewport->ID);
|
||||
window_flags |= ImGuiWindowFlags_NoTitleBar |
|
||||
ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
|
||||
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus |
|
||||
ImGuiWindowFlags_NoNavFocus;
|
||||
window_flags |= ImGuiWindowFlags_NoBackground;
|
||||
}
|
||||
{
|
||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||
ImGui::SetNextWindowPos(viewport->WorkPos);
|
||||
ImGui::SetNextWindowSize(viewport->WorkSize);
|
||||
ImGui::SetNextWindowViewport(viewport->ID);
|
||||
window_flags |=
|
||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
|
||||
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus |
|
||||
ImGuiWindowFlags_NoNavFocus;
|
||||
window_flags |= ImGuiWindowFlags_NoBackground;
|
||||
}
|
||||
|
||||
static bool p_open = true;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::Begin("DockSpace Demo", &p_open, window_flags);
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleVar(2);
|
||||
static bool p_open = true;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,
|
||||
ImVec2(0.0f, 0.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::Begin("DockSpace Demo", &p_open, window_flags);
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
ImGuiID dockspace_id = ImGui::GetID("DockSpace Demo");
|
||||
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
|
||||
ImGuiID dockspace_id = ImGui::GetID("DockSpace Demo");
|
||||
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10, 10));
|
||||
if (ImGui::BeginMenuBar()) {
|
||||
if (ImGui::BeginMenuBar()) {
|
||||
if (ImGui::BeginMenu("Pannel")) {
|
||||
onPannelMenuBar();
|
||||
onPannelMenuBar();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
TerrainEditor::onImGui();
|
||||
viewport_onImGui();
|
||||
EditorEngine::render();
|
||||
TerrainEditor::onImGui();
|
||||
viewport_onImGui();
|
||||
EditorEngine::render();
|
||||
|
||||
Scene::gizmoRenderer.refresh();
|
||||
ImGui::End();
|
||||
}
|
||||
Scene::gizmoRenderer.refresh();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void onEvent(Event& e) {
|
||||
//viewport_onEvent(e);
|
||||
void onEvent(Event& e) {
|
||||
// viewport_onEvent(e);
|
||||
|
||||
EventDispatcher ed(e);
|
||||
|
||||
ed.dispatch<WindowCloseEvent>(onWindowCloseEvent);
|
||||
}
|
||||
}
|
||||
|
||||
bool onWindowCloseEvent(WindowCloseEvent&) {
|
||||
Application::shutdown();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} // namespace Deer
|
||||
} // namespace DeerStudio
|
||||
} // namespace Deer
|
@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "DeerStudio/EditorEngine/API/Asset.h"
|
||||
#include "DeerStudio/EditorEngine/API/Debug.h"
|
||||
#include "DeerStudio/EditorEngine/API/Entity.h"
|
||||
#include "DeerStudio/EditorEngine/API/Layout.h"
|
||||
#include "DeerStudio/EditorEngine/API/Menu.h"
|
||||
#include "DeerStudio/EditorEngine/API/Resource.h"
|
||||
#include "DeerStudio/EditorEngine/API/UI.h"
|
||||
#include "DeerStudio/EditorEngine/API/Math.h"
|
||||
#include "DeerStudio/EditorEngine/API/FrameBuffer.h"
|
||||
#include "DeerStudio/EditorEngine/API/Environment.h"
|
||||
|
||||
#include "DeerStudio/EditorEngine/API/FrameBuffer.h"
|
||||
#include "DeerStudio/EditorEngine/API/Layout.h"
|
||||
#include "DeerStudio/EditorEngine/API/Math.h"
|
||||
#include "DeerStudio/EditorEngine/API/Menu.h"
|
||||
#include "DeerStudio/EditorEngine/API/UI.h"
|
||||
|
35
DeerStudio/src/DeerStudio/EditorEngine/API/Asset.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
namespace Deer {
|
||||
namespace EditorEngine {
|
||||
enum AssetType : uint32_t {
|
||||
NONE = 0,
|
||||
MESH = 1,
|
||||
SHADER = 2,
|
||||
};
|
||||
|
||||
// Returns the count of meshes in the dir relative to the mesh root dir
|
||||
int getAssetCount(AssetType, std::string& dir);
|
||||
// Returns the path to the mesh with id i
|
||||
std::string getAssetNameById(AssetType, std::string& dir, int i);
|
||||
// Returns the name of the mesh with id i
|
||||
std::string getAssetTypePathById(AssetType, std::string& dir, int i);
|
||||
|
||||
// Returns the count of sub dirs in the dir relative to the mesh root
|
||||
// dir
|
||||
int getDirCount(AssetType, std::string&);
|
||||
// Returns the path to the subDir in the dir relative to the mesh root
|
||||
// dir
|
||||
std::string getDirPathById(AssetType, std::string& dir, int i);
|
||||
// Returns the name of the subDir in the dir relative to the mesh root
|
||||
// dir
|
||||
std::string getDirNameById(AssetType, std::string& dir, int i);
|
||||
|
||||
// INTERNAL
|
||||
const char* getAssetTypePath(AssetType);
|
||||
const char* getAssetTypeExtension(AssetType);
|
||||
const char* getAssetTypeName(AssetType);
|
||||
} // namespace EditorEngine
|
||||
} // namespace Deer
|
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
namespace Deer {
|
||||
namespace EditorEngine {
|
||||
enum ResourceType : uint32_t {
|
||||
NOTHING = 0,
|
||||
MESH = 1,
|
||||
SHADER = 2,
|
||||
};
|
||||
|
||||
// Returns the count of meshes in the dir relative to the mesh root dir
|
||||
int getResourceCount(ResourceType, std::string& dir);
|
||||
// Returns the path to the mesh with id i
|
||||
std::string getResourceNameById(ResourceType, std::string& dir, int i);
|
||||
// Returns the name of the mesh with id i
|
||||
std::string getResourcePathById(ResourceType, std::string& dir, int i);
|
||||
|
||||
// Returns the count of sub dirs in the dir relative to the mesh root dir
|
||||
int getDirCount(ResourceType, std::string&);
|
||||
// Returns the path to the subDir in the dir relative to the mesh root dir
|
||||
std::string getDirPathById(ResourceType, std::string& dir, int i);
|
||||
// Returns the name of the subDir in the dir relative to the mesh root dir
|
||||
std::string getDirNameById(ResourceType, std::string& dir, int i);
|
||||
|
||||
// INTERNAL
|
||||
const char* getResourcePath(ResourceType);
|
||||
const char* getResourceExtension(ResourceType);
|
||||
const char* getResourceName(ResourceType);
|
||||
}
|
||||
}
|
@ -1,204 +1,212 @@
|
||||
#include "DeerStudio/EditorEngine/API/Resource.h"
|
||||
#include "DeerStudio/EditorEngine.h"
|
||||
#include "Deer/DataStore.h"
|
||||
#include "DeerStudio/EditorEngine/DockPanel/DockPanelObject.h"
|
||||
#include "Deer/Log.h"
|
||||
#include "DeerStudio/EditorEngine.h"
|
||||
#include "DeerStudio/EditorEngine/API/Asset.h"
|
||||
#include "DeerStudio/EditorEngine/DockPanel/DockPanelObject.h"
|
||||
|
||||
namespace Deer {
|
||||
namespace EditorEngine {
|
||||
|
||||
const char* getResourcePath(ResourceType resource) {
|
||||
switch (resource)
|
||||
{
|
||||
case ResourceType::NOTHING:
|
||||
return nullptr;
|
||||
|
||||
case ResourceType::MESH :
|
||||
return DEER_MESH_PATH;
|
||||
namespace EditorEngine {
|
||||
|
||||
case ResourceType::SHADER :
|
||||
return DEER_SHADER_PATH;
|
||||
}
|
||||
const char* getAssetTypePath(AssetType resource) {
|
||||
switch (resource) {
|
||||
case AssetType::NONE:
|
||||
return nullptr;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
case AssetType::MESH:
|
||||
return DEER_MESH_PATH;
|
||||
|
||||
const char* getResourceExtension(ResourceType resource) {
|
||||
switch (resource)
|
||||
{
|
||||
case ResourceType::NOTHING:
|
||||
return nullptr;
|
||||
|
||||
case ResourceType::MESH :
|
||||
return DEER_MESH_EXTENSION;
|
||||
case AssetType::SHADER:
|
||||
return DEER_SHADER_PATH;
|
||||
}
|
||||
|
||||
case ResourceType::SHADER :
|
||||
return DEER_SHADER_EXTENSION;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
const char* getAssetTypeExtension(AssetType resource) {
|
||||
switch (resource) {
|
||||
case AssetType::NONE:
|
||||
return nullptr;
|
||||
|
||||
const char* getResourceName(ResourceType resource) {
|
||||
switch (resource)
|
||||
{
|
||||
case ResourceType::NOTHING:
|
||||
return "???";
|
||||
|
||||
case ResourceType::MESH :
|
||||
return "Mesh";
|
||||
case AssetType::MESH:
|
||||
return DEER_MESH_EXTENSION;
|
||||
|
||||
case ResourceType::SHADER :
|
||||
return "Shader";
|
||||
}
|
||||
case AssetType::SHADER:
|
||||
return DEER_SHADER_EXTENSION;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int getResourceCount(ResourceType type, std::string& dir) {
|
||||
const char* resourcePath = getResourcePath(type);
|
||||
const char* resourceExtension = getResourceExtension(type);
|
||||
const char* getAssetTypeName(AssetType resource) {
|
||||
switch (resource) {
|
||||
case AssetType::NONE:
|
||||
return "???";
|
||||
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid resource type calling getResourceCount(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case AssetType::MESH:
|
||||
return "Mesh";
|
||||
|
||||
return DataStore::getDirData(resourcePath, dir, resourceExtension).elements.size();
|
||||
}
|
||||
|
||||
std::string getResourceNameById(ResourceType type, std::string& dir, int i) {
|
||||
const char* resourcePath = getResourcePath(type);
|
||||
const char* resourceExtension = getResourceExtension(type);
|
||||
case AssetType::SHADER:
|
||||
return "Shader";
|
||||
}
|
||||
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid resource type calling getResourceNameById(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const DirectoryData& dirData = DataStore::getDirData(resourcePath, dir, resourceExtension);
|
||||
if (i < 0 || i >= dirData.elements.size()) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid element id {3} calling getResourceNameById(..) for type {0} and path {1}, element count on that dir is {2}",
|
||||
getResourceName(type),
|
||||
dir.c_str(),
|
||||
dirData.elements.size(),
|
||||
i
|
||||
);
|
||||
|
||||
if (currentDockPanelExecution)
|
||||
currentDockPanelExecution->invalidate();
|
||||
return "";
|
||||
}
|
||||
int getAssetCount(AssetType type, std::string& dir) {
|
||||
const char* resourcePath = getAssetTypePath(type);
|
||||
const char* resourceExtension = getAssetTypeExtension(type);
|
||||
|
||||
return dirData.elements[i].stem().string();
|
||||
}
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid resource type calling getAssetCount(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string getResourcePathById(ResourceType type, std::string& dir, int i) {
|
||||
const char* resourcePath = getResourcePath(type);
|
||||
const char* resourceExtension = getResourceExtension(type);
|
||||
return DataStore::getDirData(resourcePath, dir, resourceExtension)
|
||||
.elements.size();
|
||||
}
|
||||
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid resource type calling getResourcePathById(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
std::string getAssetNameById(AssetType type, std::string& dir, int i) {
|
||||
const char* resourcePath = getAssetTypePath(type);
|
||||
const char* resourceExtension = getAssetTypeExtension(type);
|
||||
|
||||
const DirectoryData& dirData = DataStore::getDirData(resourcePath, dir, resourceExtension);
|
||||
if (i < 0 || i >= dirData.elements.size()) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid element id {3} calling getResourcePathById(..) for type {0} and path {1}, element count on that dir is {2}",
|
||||
getResourceName(type),
|
||||
dir.c_str(),
|
||||
dirData.elements.size(),
|
||||
i
|
||||
);
|
||||
|
||||
if (currentDockPanelExecution)
|
||||
currentDockPanelExecution->invalidate();
|
||||
return "";
|
||||
}
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid resource type calling getAssetNameById(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
return dirData.elements[i].string();
|
||||
}
|
||||
const DirectoryData& dirData =
|
||||
DataStore::getDirData(resourcePath, dir, resourceExtension);
|
||||
if (i < 0 || i >= dirData.elements.size()) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid element id {3} calling getAssetNameById(..) "
|
||||
"for type {0} and path {1}, element count on that dir is "
|
||||
"{2}",
|
||||
getAssetTypeName(type), dir.c_str(),
|
||||
dirData.elements.size(), i);
|
||||
|
||||
int getDirCount(ResourceType type, std::string& dir) {
|
||||
const char* resourcePath = getResourcePath(type);
|
||||
const char* resourceExtension = getResourceExtension(type);
|
||||
if (currentDockPanelExecution)
|
||||
currentDockPanelExecution->invalidate();
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid resource type calling getDirCount(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return dirData.elements[i].stem().string();
|
||||
}
|
||||
|
||||
return DataStore::getDirData(resourcePath, dir, resourceExtension).dirs.size();
|
||||
}
|
||||
|
||||
std::string getDirPathById(ResourceType type, std::string& dir, int i) {
|
||||
const char* resourcePath = getResourcePath(type);
|
||||
const char* resourceExtension = getResourceExtension(type);
|
||||
std::string getAssetTypePathById(AssetType type, std::string& dir,
|
||||
int i) {
|
||||
const char* resourcePath = getAssetTypePath(type);
|
||||
const char* resourceExtension = getAssetTypeExtension(type);
|
||||
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid resource type calling getDirPathById(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid resource type calling getAssetTypePathById(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const DirectoryData& dirData = DataStore::getDirData(resourcePath, dir, resourceExtension);
|
||||
if (i < 0 || i >= dirData.dirs.size()) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid element id {3} calling getDirPathById(..) for type {0} and path {1}, sub_dir count on that dir is {2}",
|
||||
getResourceName(type),
|
||||
dir.c_str(),
|
||||
dirData.dirs.size(),
|
||||
i)
|
||||
;
|
||||
|
||||
if (currentDockPanelExecution)
|
||||
currentDockPanelExecution->invalidate();
|
||||
return "";
|
||||
}
|
||||
const DirectoryData& dirData =
|
||||
DataStore::getDirData(resourcePath, dir, resourceExtension);
|
||||
if (i < 0 || i >= dirData.elements.size()) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid element id {3} calling getAssetTypePathById(..) "
|
||||
"for type {0} and path {1}, element count on that dir is "
|
||||
"{2}",
|
||||
getAssetTypeName(type), dir.c_str(),
|
||||
dirData.elements.size(), i);
|
||||
|
||||
return dirData.dirs[i].string();
|
||||
}
|
||||
|
||||
std::string getDirNameById(ResourceType type, std::string& dir, int i) {
|
||||
const char* resourcePath = getResourcePath(type);
|
||||
const char* resourceExtension = getResourceExtension(type);
|
||||
if (currentDockPanelExecution)
|
||||
currentDockPanelExecution->invalidate();
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid resource type calling getDirNameById(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
return dirData.elements[i].string();
|
||||
}
|
||||
|
||||
const DirectoryData& dirData = DataStore::getDirData(resourcePath, dir, resourceExtension);
|
||||
if (i < 0 || i >= dirData.dirs.size()) {
|
||||
DEER_EDITOR_ENGINE_ERROR("Invalid element id {3} calling getDirPathById(..) for type {0} and path {1}, sub_dir count on that dir is {2}",
|
||||
getResourceName(type),
|
||||
dir.c_str(),
|
||||
dirData.dirs.size(),
|
||||
i
|
||||
);
|
||||
|
||||
if (currentDockPanelExecution)
|
||||
currentDockPanelExecution->invalidate();
|
||||
return "";
|
||||
}
|
||||
int getDirCount(AssetType type, std::string& dir) {
|
||||
const char* resourcePath = getAssetTypePath(type);
|
||||
const char* resourceExtension = getAssetTypeExtension(type);
|
||||
|
||||
return dirData.dirs[i].stem().string();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid resource type calling getDirCount(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DataStore::getDirData(resourcePath, dir, resourceExtension)
|
||||
.dirs.size();
|
||||
}
|
||||
|
||||
std::string getDirPathById(AssetType type, std::string& dir, int i) {
|
||||
const char* resourcePath = getAssetTypePath(type);
|
||||
const char* resourceExtension = getAssetTypeExtension(type);
|
||||
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid resource type calling getDirPathById(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const DirectoryData& dirData =
|
||||
DataStore::getDirData(resourcePath, dir, resourceExtension);
|
||||
if (i < 0 || i >= dirData.dirs.size()) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid element id {3} calling getDirPathById(..) for "
|
||||
"type {0} and path {1}, sub_dir count on that dir is {2}",
|
||||
getAssetTypeName(type), dir.c_str(), dirData.dirs.size(),
|
||||
i);
|
||||
|
||||
if (currentDockPanelExecution)
|
||||
currentDockPanelExecution->invalidate();
|
||||
return "";
|
||||
}
|
||||
|
||||
return dirData.dirs[i].string();
|
||||
}
|
||||
|
||||
std::string getDirNameById(AssetType type, std::string& dir, int i) {
|
||||
const char* resourcePath = getAssetTypePath(type);
|
||||
const char* resourceExtension = getAssetTypeExtension(type);
|
||||
|
||||
if (!resourcePath || !resourceExtension) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid resource type calling getDirNameById(..)");
|
||||
if (currentDockPanelExecution) {
|
||||
currentDockPanelExecution->invalidate();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const DirectoryData& dirData =
|
||||
DataStore::getDirData(resourcePath, dir, resourceExtension);
|
||||
if (i < 0 || i >= dirData.dirs.size()) {
|
||||
DEER_EDITOR_ENGINE_ERROR(
|
||||
"Invalid element id {3} calling getDirPathById(..) for "
|
||||
"type {0} and path {1}, sub_dir count on that dir is {2}",
|
||||
getAssetTypeName(type), dir.c_str(), dirData.dirs.size(),
|
||||
i);
|
||||
|
||||
if (currentDockPanelExecution)
|
||||
currentDockPanelExecution->invalidate();
|
||||
return "";
|
||||
}
|
||||
|
||||
return dirData.dirs[i].stem().string();
|
||||
}
|
||||
} // namespace EditorEngine
|
||||
} // namespace Deer
|
@ -1,51 +1,80 @@
|
||||
#include "DeerStudio/EditorEngine/API.h"
|
||||
#include "DeerStudio/EditorEngine.h"
|
||||
#include "DeerStudio/EditorEngine/ErrorHandle.h"
|
||||
#include "DeerStudio/EditorEngine/API_Registration/API_Registration.h"
|
||||
#include "DeerStudio/EditorEngine.h"
|
||||
#include "DeerStudio/EditorEngine/API.h"
|
||||
#include "DeerStudio/EditorEngine/API_Registration/API_Registration.h"
|
||||
#include "DeerStudio/EditorEngine/ErrorHandle.h"
|
||||
|
||||
#include "angelscript.h"
|
||||
#include "angelscript.h"
|
||||
|
||||
namespace Deer {
|
||||
void EditorEngine::registerEditorEngineFunctions() {
|
||||
registerEntityFunctions();
|
||||
registerMathFunctions();
|
||||
registerUIFunctions();
|
||||
registerFrameBufferFunctions();
|
||||
registerEnvironmentFunctions();
|
||||
namespace Deer {
|
||||
void EditorEngine::registerEditorEngineFunctions() {
|
||||
registerEntityFunctions();
|
||||
registerMathFunctions();
|
||||
registerUIFunctions();
|
||||
registerFrameBufferFunctions();
|
||||
registerEnvironmentFunctions();
|
||||
|
||||
scriptEngine->SetDefaultNamespace("UI");
|
||||
REGISTER_GLOBAL_FUNC("void setupAutomaticColumns(int)", setupAutomaticColumns);
|
||||
REGISTER_GLOBAL_FUNC("void setupColumns(int)", setupColumns);
|
||||
REGISTER_GLOBAL_FUNC("void endColumns()", endColumns);
|
||||
REGISTER_GLOBAL_FUNC("void nextColumn()", nextColumn);
|
||||
scriptEngine->SetDefaultNamespace("");
|
||||
scriptEngine->SetDefaultNamespace("UI");
|
||||
REGISTER_GLOBAL_FUNC("void setupAutomaticColumns(int)",
|
||||
setupAutomaticColumns);
|
||||
REGISTER_GLOBAL_FUNC("void setupColumns(int)", setupColumns);
|
||||
REGISTER_GLOBAL_FUNC("void endColumns()", endColumns);
|
||||
REGISTER_GLOBAL_FUNC("void nextColumn()", nextColumn);
|
||||
scriptEngine->SetDefaultNamespace("");
|
||||
|
||||
scriptEngine->SetDefaultNamespace("Resource");
|
||||
REGISTER_GLOBAL_FUNC("int getResourceCount(ResourceType, const string& in)", getResourceCount);
|
||||
REGISTER_GLOBAL_FUNC("string getResourceNameById(ResourceType, const string& in, int)", getResourceNameById);
|
||||
REGISTER_GLOBAL_FUNC("string getResourcePathById(ResourceType, const string& in, int)", getResourcePathById);
|
||||
REGISTER_GLOBAL_FUNC("int getDirCount(ResourceType, const string& in)", getDirCount);
|
||||
REGISTER_GLOBAL_FUNC("string getDirPathById(ResourceType, const string& in, int)", getDirPathById);
|
||||
REGISTER_GLOBAL_FUNC("string getDirNameById(ResourceType, const string& in, int)", getDirNameById);
|
||||
scriptEngine->SetDefaultNamespace("");
|
||||
scriptEngine->SetDefaultNamespace("Assets");
|
||||
REGISTER_GLOBAL_FUNC("int getAssetCount(AssetType, const string& in)",
|
||||
getAssetCount);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"string getAssetNameById(AssetType, const string& in, int)",
|
||||
getAssetNameById);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"string getAssetTypePathById(AssetType, const string& in, int)",
|
||||
getAssetTypePathById);
|
||||
REGISTER_GLOBAL_FUNC("int getDirCount(AssetType, const string& in)",
|
||||
getDirCount);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"string getDirPathById(AssetType, const string& in, int)",
|
||||
getDirPathById);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"string getDirNameById(AssetType, const string& in, int)",
|
||||
getDirNameById);
|
||||
scriptEngine->SetDefaultNamespace("");
|
||||
|
||||
scriptEngine->SetDefaultNamespace("Engine");
|
||||
REGISTER_GLOBAL_FUNC("void print(const string& in)", print);
|
||||
scriptEngine->SetDefaultNamespace("");
|
||||
scriptEngine->SetDefaultNamespace("Engine");
|
||||
REGISTER_GLOBAL_FUNC("void print(const string& in)", print);
|
||||
scriptEngine->SetDefaultNamespace("");
|
||||
|
||||
scriptEngine->SetDefaultNamespace("UI");
|
||||
REGISTER_GLOBAL_FUNC("void treeNodeLeaf(const string& in, bool)", treeNode);
|
||||
REGISTER_GLOBAL_FUNC("bool treeNode(const string& in, bool, any@+, ReciverFunc@+)", treeNodeRecursive);
|
||||
REGISTER_GLOBAL_FUNC("bool componentNode(const string& in, any@+, ReciverFunc@+)", componentNode);
|
||||
REGISTER_GLOBAL_FUNC("bool componentNode_contextMenu(const string& in, any@+, ReciverFunc@+, ReciverFunc@+)", componentNode_contextMenu);
|
||||
REGISTER_GLOBAL_FUNC("void contextItemPopup(const string& in, any@+, ReciverFunc@+)", contextItemPopup);
|
||||
REGISTER_GLOBAL_FUNC("void contextMenuPopup(const string& in, any@+, ReciverFunc@+)", contextMenuPopup);
|
||||
REGISTER_GLOBAL_FUNC("void modalPopup(const string& in, ReciverFunc@+)", modalPopup);
|
||||
REGISTER_GLOBAL_FUNC("void simplePopup(const string& in, ReciverFunc@+)", simplePopup);
|
||||
REGISTER_GLOBAL_FUNC("void openPopup(const string& in, any@)", openPopup);
|
||||
REGISTER_GLOBAL_FUNC("void closePopup()", closePopup);
|
||||
REGISTER_GLOBAL_FUNC("void dragDropSource(const string& in, any@, const string& in)", dragDropSource);
|
||||
REGISTER_GLOBAL_FUNC("void dragDropTarget(const string& in, any@+, TransferFunc@+)", dragDropTarget);
|
||||
scriptEngine->SetDefaultNamespace("");
|
||||
}
|
||||
}
|
||||
scriptEngine->SetDefaultNamespace("UI");
|
||||
REGISTER_GLOBAL_FUNC("void treeNodeLeaf(const string& in, bool)",
|
||||
treeNode);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"bool treeNode(const string& in, bool, any@+, ReciverFunc@+)",
|
||||
treeNodeRecursive);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"bool componentNode(const string& in, any@+, ReciverFunc@+)",
|
||||
componentNode);
|
||||
REGISTER_GLOBAL_FUNC("bool componentNode_contextMenu(const string& in, "
|
||||
"any@+, ReciverFunc@+, ReciverFunc@+)",
|
||||
componentNode_contextMenu);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"void contextItemPopup(const string& in, any@+, ReciverFunc@+)",
|
||||
contextItemPopup);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"void contextMenuPopup(const string& in, any@+, ReciverFunc@+)",
|
||||
contextMenuPopup);
|
||||
REGISTER_GLOBAL_FUNC("void modalPopup(const string& in, ReciverFunc@+)",
|
||||
modalPopup);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"void simplePopup(const string& in, ReciverFunc@+)", simplePopup);
|
||||
REGISTER_GLOBAL_FUNC("void openPopup(const string& in, any@)",
|
||||
openPopup);
|
||||
REGISTER_GLOBAL_FUNC("void closePopup()", closePopup);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"void dragDropSource(const string& in, any@, const string& in)",
|
||||
dragDropSource);
|
||||
REGISTER_GLOBAL_FUNC(
|
||||
"void dragDropTarget(const string& in, any@+, TransferFunc@+)",
|
||||
dragDropTarget);
|
||||
scriptEngine->SetDefaultNamespace("");
|
||||
}
|
||||
} // namespace Deer
|
@ -1,38 +1,44 @@
|
||||
#include "DeerStudio/EditorEngine.h"
|
||||
#include "DeerStudio/EditorEngine/ErrorHandle.h"
|
||||
#include "DeerStudio/EditorEngine/API.h"
|
||||
#include "DeerStudio/EditorEngine/ErrorHandle.h"
|
||||
|
||||
#include "scripthandle.h"
|
||||
#include "scriptany.h"
|
||||
#include "angelscript.h"
|
||||
#include "scriptany.h"
|
||||
#include "scripthandle.h"
|
||||
|
||||
namespace Deer {
|
||||
namespace EditorEngine {
|
||||
void registerResourceTypeEnum() {
|
||||
AS_RET_CHECK(scriptEngine->RegisterEnum("ResourceType"));
|
||||
AS_CHECK(scriptEngine->RegisterEnumValue("ResourceType", "Mesh", (int)ResourceType::MESH));
|
||||
AS_CHECK(scriptEngine->RegisterEnumValue("ResourceType", "Shader", (int)ResourceType::SHADER));
|
||||
}
|
||||
namespace EditorEngine {
|
||||
void registerAssetTypeEnum() {
|
||||
AS_RET_CHECK(scriptEngine->RegisterEnum("AssetType"));
|
||||
AS_CHECK(scriptEngine->RegisterEnumValue("AssetType", "None",
|
||||
(int)AssetType::NONE));
|
||||
AS_CHECK(scriptEngine->RegisterEnumValue("AssetType", "Shader",
|
||||
(int)AssetType::SHADER));
|
||||
AS_CHECK(scriptEngine->RegisterEnumValue("AssetType", "Mesh",
|
||||
(int)AssetType::MESH));
|
||||
}
|
||||
|
||||
void registerEditorEngineStructs() {
|
||||
RegisterScriptHandle(scriptEngine);
|
||||
RegisterScriptAny(scriptEngine);
|
||||
void registerEditorEngineStructs() {
|
||||
RegisterScriptHandle(scriptEngine);
|
||||
RegisterScriptAny(scriptEngine);
|
||||
|
||||
AS_RET_CHECK(scriptEngine->RegisterInterface("DockPanel"));
|
||||
AS_RET_CHECK(scriptEngine->RegisterInterfaceMethod("DockPanel", "void onRender()"));
|
||||
AS_RET_CHECK(scriptEngine->RegisterInterface("DockPanel"));
|
||||
AS_RET_CHECK(scriptEngine->RegisterInterfaceMethod(
|
||||
"DockPanel", "void onRender()"));
|
||||
|
||||
AS_RET_CHECK(scriptEngine->RegisterInterface("ServiceScript"));
|
||||
AS_RET_CHECK(scriptEngine->RegisterInterface("ServiceScript"));
|
||||
|
||||
AS_CHECK(scriptEngine->RegisterFuncdef("void ReciverFunc(any@)"));
|
||||
AS_CHECK(scriptEngine->RegisterFuncdef("void TransferFunc(any@, any@)"));
|
||||
AS_CHECK(scriptEngine->RegisterFuncdef("void ReciverFunc(any@)"));
|
||||
AS_CHECK(
|
||||
scriptEngine->RegisterFuncdef("void TransferFunc(any@, any@)"));
|
||||
|
||||
registerUIStructs();
|
||||
registerResourceTypeEnum();
|
||||
registerEntityStructs();
|
||||
registerMathStructs();
|
||||
registerFrameBufferStructs();
|
||||
registerEnvironmentStructs();
|
||||
}
|
||||
registerUIStructs();
|
||||
registerAssetTypeEnum();
|
||||
registerEntityStructs();
|
||||
registerMathStructs();
|
||||
registerFrameBufferStructs();
|
||||
registerEnvironmentStructs();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace EditorEngine
|
||||
} // namespace Deer
|
@ -127,6 +127,7 @@ void printClassTypeList(const asIScriptEngine& engine) {
|
||||
for (int j = 0; j < t->GetMethodCount(); ++j) {
|
||||
const auto m = t->GetMethodByIndex(j);
|
||||
stream << "\t" << m->GetDeclaration(false, false, true);
|
||||
|
||||
if (m->IsProperty())
|
||||
stream << " property";
|
||||
stream << ";\n";
|
||||
|
@ -162,7 +162,11 @@ namespace Deer {
|
||||
asITypeInfo* paramType =
|
||||
scriptEngine->GetTypeInfoById(typeId);
|
||||
|
||||
ext_dec << paramType->GetName();
|
||||
const char* typeName =
|
||||
scriptEngine->GetTypeDeclaration(typeId, false);
|
||||
|
||||
ext_dec << typeName;
|
||||
|
||||
if (name != nullptr)
|
||||
ext_dec << " " << name;
|
||||
}
|
||||
@ -178,9 +182,11 @@ namespace Deer {
|
||||
serviceScriptFunction->scriptContext = scriptContext;
|
||||
serviceScriptFunction->scriptObject = object;
|
||||
|
||||
AS_CHECK(scriptEngine->RegisterGlobalFunction(
|
||||
ext_dec.str().c_str(), asFUNCTION(apiFunction),
|
||||
asCALL_GENERIC, serviceScriptFunction));
|
||||
AS_CHECK_ADDITIONAL_INFO(
|
||||
scriptEngine->RegisterGlobalFunction(
|
||||
ext_dec.str().c_str(), asFUNCTION(apiFunction),
|
||||
asCALL_GENERIC, serviceScriptFunction),
|
||||
ext_dec.str().c_str());
|
||||
}
|
||||
}
|
||||
} // namespace EditorEngine
|
||||
|
3011
roe/3dMesh.dmesh
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 575 B |
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 588 B |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
@ -1,13 +0,0 @@
|
||||
void renameEntity(any@ data) {
|
||||
Entity entity;
|
||||
data.retrieve(entity);
|
||||
|
||||
string name = entity.name;
|
||||
if (UI::inputText("##RENAME", name, name)) {
|
||||
entity.name = name;
|
||||
}
|
||||
UI::sameline();
|
||||
if (UI::button("Accept")) {
|
||||
UI::closePopup();
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
class Test : DockPanel {
|
||||
void onRender() {
|
||||
Entity ent = ActiveEntity::getActiveEntity();
|
||||
|
||||
UI::text("Hi");
|
||||
UI::text(ent.name);
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"dockPanelModule" : {
|
||||
"name" : "Test",
|
||||
"author" : "Chewico",
|
||||
"version" : "1.0.0",
|
||||
"services" : []
|
||||
}
|
||||
}
|
12
roe/Editor/Panels/AssetExplorer/AssetExplorer.as
Normal file
@ -0,0 +1,12 @@
|
||||
class AssetExplorer : DockPanel {
|
||||
AssetType searchAssetType = AssetType::None;
|
||||
string currentPath = "";
|
||||
|
||||
void onRender() {
|
||||
UI::setupAutomaticColumns(128);
|
||||
|
||||
if (searchAssetType == AssetType::None) {
|
||||
searchAssetType = renderGenerics();
|
||||
}
|
||||
}
|
||||
}
|
11
roe/Editor/Panels/AssetExplorer/Generics.as
Normal file
@ -0,0 +1,11 @@
|
||||
// Here we render the base folders
|
||||
AssetType renderGenerics() {
|
||||
AssetType selectedAssetType = AssetType::None;
|
||||
|
||||
if (drawFolder("Scripts")) selectedAssetType = AssetType::None;
|
||||
if (drawFolder("Meshes")) selectedAssetType = AssetType::Mesh;
|
||||
if (drawFolder("Textures")) selectedAssetType = AssetType::None;
|
||||
if (drawFolder("Shaders")) selectedAssetType = AssetType::Shader;
|
||||
|
||||
return selectedAssetType;
|
||||
}
|
12
roe/Editor/Panels/AssetExplorer/IconRender.as
Normal file
@ -0,0 +1,12 @@
|
||||
bool drawFolder(string&in name) {
|
||||
bool click = false;
|
||||
UI::drawIconCentered("folder", 64);
|
||||
|
||||
if (UI::isItemClicked(0) and UI::isMouseDoubleClicked(0)) {
|
||||
click = true;
|
||||
}
|
||||
|
||||
UI::textCenter(name);
|
||||
UI::nextColumn();
|
||||
return click;
|
||||
}
|
@ -16,28 +16,28 @@ class MeshExplorer : DockPanel {
|
||||
UI::nextColumn();
|
||||
}
|
||||
|
||||
ResourceType resourceType = ResourceType::Mesh;
|
||||
int dirCount = Resource::getDirCount(resourceType, cache_currentPath);
|
||||
AssetType resourceType = AssetType::Mesh;
|
||||
int dirCount = Assets::getDirCount(resourceType, cache_currentPath);
|
||||
for (int i = 0; i < dirCount; i++) {
|
||||
UI::drawIconCentered("folder", 64);
|
||||
|
||||
if (UI::isItemClicked(0) and UI::isMouseDoubleClicked(0)) {
|
||||
Engine::print(Resource::getDirPathById(ResourceType::Mesh, cache_currentPath, i));
|
||||
currentPath = Resource::getDirPathById(ResourceType::Mesh, cache_currentPath, i);
|
||||
Engine::print(Assets::getDirPathById(AssetType::Mesh, cache_currentPath, i));
|
||||
currentPath = Assets::getDirPathById(AssetType::Mesh, cache_currentPath, i);
|
||||
}
|
||||
|
||||
UI::textCenter(Resource::getDirNameById(ResourceType::Mesh, cache_currentPath, i));
|
||||
UI::textCenter(Assets::getDirNameById(AssetType::Mesh, cache_currentPath, i));
|
||||
UI::nextColumn();
|
||||
}
|
||||
|
||||
int meshCount = Resource::getResourceCount(ResourceType::Mesh, cache_currentPath);
|
||||
int meshCount = Assets::getAssetCount(AssetType::Mesh, cache_currentPath);
|
||||
for (int i = 0; i < meshCount; i++) {
|
||||
UI::drawIconCentered("file", 64);
|
||||
UI::dragDropSource("MESH",
|
||||
any(Resource::getResourcePathById(ResourceType::Mesh, cache_currentPath, i)),
|
||||
Resource::getResourcePathById(ResourceType::Mesh, cache_currentPath, i));
|
||||
any(Assets::getAssetTypePathById(AssetType::Mesh, cache_currentPath, i)),
|
||||
Assets::getAssetTypePathById(AssetType::Mesh, cache_currentPath, i));
|
||||
|
||||
UI::textCenter(Resource::getResourceNameById(ResourceType::Mesh, cache_currentPath, i));
|
||||
UI::textCenter(Assets::getAssetNameById(AssetType::Mesh, cache_currentPath, i));
|
||||
UI::nextColumn();
|
||||
}
|
||||
UI::endColumns();
|
@ -1,4 +1,3 @@
|
||||
|
||||
class ShaderExplorer : DockPanel {
|
||||
string currentPath = "";
|
||||
|
||||
@ -16,31 +15,30 @@ class ShaderExplorer : DockPanel {
|
||||
UI::nextColumn();
|
||||
}
|
||||
|
||||
ResourceType resourceType = ResourceType::Shader;
|
||||
int dirCount = Resource::getDirCount(resourceType, cache_currentPath);
|
||||
AssetType resourceType = AssetType::Shader;
|
||||
int dirCount = Assets::getDirCount(resourceType, cache_currentPath);
|
||||
for (int i = 0; i < dirCount; i++) {
|
||||
UI::drawIconCentered("folder", 64);
|
||||
|
||||
if (UI::isItemClicked(0) and UI::isMouseDoubleClicked(0)) {
|
||||
Engine::print(Resource::getDirPathById(resourceType, cache_currentPath, i));
|
||||
currentPath = Resource::getDirPathById(resourceType, cache_currentPath, i);
|
||||
Engine::print(Assets::getDirPathById(resourceType, cache_currentPath, i));
|
||||
currentPath = Assets::getDirPathById(resourceType, cache_currentPath, i);
|
||||
}
|
||||
|
||||
UI::textCenter(Resource::getDirNameById(resourceType, cache_currentPath, i));
|
||||
UI::textCenter(Assets::getDirNameById(resourceType, cache_currentPath, i));
|
||||
UI::nextColumn();
|
||||
}
|
||||
|
||||
int meshCount = Resource::getResourceCount(resourceType, cache_currentPath);
|
||||
int meshCount = Assets::getAssetCount(resourceType, cache_currentPath);
|
||||
for (int i = 0; i < meshCount; i++) {
|
||||
UI::drawIconCentered("file", 64);
|
||||
UI::dragDropSource("SHADER",
|
||||
any(Resource::getResourcePathById(resourceType, cache_currentPath, i)),
|
||||
Resource::getResourcePathById(resourceType, cache_currentPath, i));
|
||||
any(Assets::getAssetTypePathById(resourceType, cache_currentPath, i)),
|
||||
Assets::getAssetTypePathById(resourceType, cache_currentPath, i));
|
||||
|
||||
|
||||
UI::textCenter(Resource::getResourceNameById(resourceType, cache_currentPath, i));
|
||||
UI::textCenter(Assets::getAssetNameById(resourceType, cache_currentPath, i));
|
||||
UI::nextColumn();
|
||||
}
|
||||
UI::endColumns();
|
||||
}
|
||||
}
|
||||
}
|
@ -65,9 +65,10 @@ enum key {
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
@ -381,12 +382,12 @@ namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Resource { int getResourceCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { int getDirCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
@ -467,9 +468,10 @@ enum key {
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
@ -783,12 +785,12 @@ namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Resource { int getResourceCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { int getDirCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
@ -804,3 +806,4 @@ namespace UI { void dragDropSource(const string&in, any@, const string&in); }
|
||||
namespace UI { void dragDropTarget(const string&in, any@, TransferFunc@); }
|
||||
namespace ActiveEntity { Entity getActiveEntity(); }
|
||||
namespace ActiveEntity { void setActiveEntity(Entity); }
|
||||
namespace ActiveEntity { void renameEntity(any@); }
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"dockPanelModule" : {
|
||||
"name" : "Explorers",
|
||||
"name" : "Asset Explorer",
|
||||
"author" : "Chewico",
|
||||
"version" : "1.0.0",
|
||||
"services" : []
|
@ -6,9 +6,6 @@ class PropertiesPannel : DockPanel {
|
||||
void onRender() {
|
||||
Entity entity = ActiveEntity::getActiveEntity();
|
||||
|
||||
// We don't want to change root options
|
||||
if (entity.isRoot)
|
||||
return;
|
||||
// NAME
|
||||
// -------
|
||||
// Id:0 [+ add component]
|
||||
@ -18,6 +15,10 @@ class PropertiesPannel : DockPanel {
|
||||
UI::separator();
|
||||
UI::textColor(0.5, 0.5, 0.5f, "Id : " + entity.id);
|
||||
|
||||
// We don't want to change root options
|
||||
if (entity.isRoot)
|
||||
return;
|
||||
|
||||
UI::sameline();
|
||||
if (UI::buttonEnd("Add Component")) {
|
||||
UI::openPopup("ADD_COMPONENT", any(entity));
|
||||
@ -48,7 +49,7 @@ class PropertiesPannel : DockPanel {
|
||||
}
|
||||
|
||||
UI::simplePopup("ADD_COMPONENT", addComponentPopup);
|
||||
UI::modalPopup("Rename entity", renameEntity);
|
||||
UI::modalPopup("Rename entity", ActiveEntity::renameEntity);
|
||||
}
|
||||
|
||||
void renameEntityMenu(any@ data) {
|
@ -65,9 +65,10 @@ enum key {
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
@ -381,12 +382,12 @@ namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Resource { int getResourceCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { int getDirCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
@ -467,9 +468,10 @@ enum key {
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
@ -783,12 +785,12 @@ namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Resource { int getResourceCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { int getDirCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
@ -804,3 +806,4 @@ namespace UI { void dragDropSource(const string&in, any@, const string&in); }
|
||||
namespace UI { void dragDropTarget(const string&in, any@, TransferFunc@); }
|
||||
namespace ActiveEntity { Entity getActiveEntity(); }
|
||||
namespace ActiveEntity { void setActiveEntity(Entity); }
|
||||
namespace ActiveEntity { void renameEntity(any@); }
|
@ -3,17 +3,25 @@ class TreePannel : DockPanel {
|
||||
Entity root = Engine::getRoot();
|
||||
UI::contextMenuPopup("Window popup", any(root), ReciverFunc(this.entityContextMenu));
|
||||
|
||||
renderNode(any(root));
|
||||
if (root.childs.count == 0) {
|
||||
// END OF THE TREE
|
||||
UI::treeNodeLeaf("Scene Environment", false);
|
||||
entityInteraction(root);
|
||||
} else {
|
||||
// ADD ANOTHER NODE
|
||||
bool opened = UI::treeNode("Scene Environment", false, any(root), ReciverFunc(this.renderNode));
|
||||
if (!opened) {
|
||||
entityInteraction(root);
|
||||
}
|
||||
}
|
||||
|
||||
UI::modalPopup("Rename entity", renameEntity);
|
||||
UI::modalPopup("Rename entity", ActiveEntity::renameEntity);
|
||||
}
|
||||
|
||||
void renderNode(any@ data) {
|
||||
Entity entity;
|
||||
data.retrieve(entity);
|
||||
|
||||
if (!entity.isRoot)
|
||||
entityInteraction(entity);
|
||||
entityInteraction(entity);
|
||||
|
||||
// Maybe we deleted the entity in the context menu
|
||||
if (!entity.exists)
|
@ -65,9 +65,10 @@ enum key {
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
@ -381,12 +382,12 @@ namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Resource { int getResourceCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { int getDirCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
@ -467,9 +468,10 @@ enum key {
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
@ -783,12 +785,12 @@ namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Resource { int getResourceCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { int getDirCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
@ -804,3 +806,4 @@ namespace UI { void dragDropSource(const string&in, any@, const string&in); }
|
||||
namespace UI { void dragDropTarget(const string&in, any@, TransferFunc@); }
|
||||
namespace ActiveEntity { Entity getActiveEntity(); }
|
||||
namespace ActiveEntity { void setActiveEntity(Entity); }
|
||||
namespace ActiveEntity { void renameEntity(any@); }
|
13
roe/Editor/Panels/TreeExplorer/dockPanelModule.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"dockPanelModule" : {
|
||||
"name" : "Tree explorer",
|
||||
"author" : "Chewico",
|
||||
"version" : "1.0.0",
|
||||
"services" : [
|
||||
{
|
||||
"name" : "ActiveEntity",
|
||||
"version" : "1.0.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -65,9 +65,10 @@ enum key {
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
@ -381,12 +382,12 @@ namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Resource { int getResourceCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { int getDirCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
@ -467,9 +468,10 @@ enum key {
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
@ -783,12 +785,12 @@ namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Resource { int getResourceCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { int getDirCount(ResourceType, const string&in); }
|
||||
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
|
||||
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
@ -804,3 +806,4 @@ namespace UI { void dragDropSource(const string&in, any@, const string&in); }
|
||||
namespace UI { void dragDropTarget(const string&in, any@, TransferFunc@); }
|
||||
namespace ActiveEntity { Entity getActiveEntity(); }
|
||||
namespace ActiveEntity { void setActiveEntity(Entity); }
|
||||
namespace ActiveEntity { void renameEntity(any@); }
|
@ -1,17 +0,0 @@
|
||||
class ActiveEntity : ServiceScript {
|
||||
Entity entity;
|
||||
|
||||
void onInit() {
|
||||
entity = Engine::getMainEnvironment().getRootEntity();
|
||||
}
|
||||
|
||||
[ServiceAPI]
|
||||
Entity getActiveEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
[ServiceAPI]
|
||||
void setActiveEntity(Entity ent) {
|
||||
entity = ent;
|
||||
}
|
||||
}
|
@ -1,542 +0,0 @@
|
||||
//This file was generated automatically
|
||||
funcdef void ReciverFunc(any@);
|
||||
funcdef void TransferFunc(any@, any@);
|
||||
enum key {
|
||||
A = 546,
|
||||
B = 547,
|
||||
C = 548,
|
||||
D = 549,
|
||||
E = 550,
|
||||
F = 551,
|
||||
G = 552,
|
||||
H = 553,
|
||||
I = 554,
|
||||
J = 555,
|
||||
K = 556,
|
||||
L = 557,
|
||||
M = 558,
|
||||
N = 559,
|
||||
O = 560,
|
||||
P = 561,
|
||||
Q = 562,
|
||||
R = 563,
|
||||
S = 564,
|
||||
T = 565,
|
||||
U = 566,
|
||||
V = 567,
|
||||
W = 568,
|
||||
X = 569,
|
||||
Y = 570,
|
||||
Z = 571,
|
||||
K0 = 536,
|
||||
K1 = 537,
|
||||
K2 = 538,
|
||||
K3 = 539,
|
||||
K4 = 540,
|
||||
K5 = 541,
|
||||
K6 = 542,
|
||||
K7 = 543,
|
||||
K8 = 544,
|
||||
K9 = 545,
|
||||
Tab = 512,
|
||||
Enter = 525,
|
||||
Escape = 526,
|
||||
Backspace = 523,
|
||||
Space = 524,
|
||||
Delete = 522,
|
||||
Insert = 521,
|
||||
Home = 519,
|
||||
End = 520,
|
||||
PageUp = 517,
|
||||
PageDown = 518,
|
||||
Right = 514,
|
||||
Up = 515,
|
||||
Down = 516,
|
||||
Left = 513,
|
||||
RightCtrl = 531,
|
||||
LeftShift = 528,
|
||||
RightShift = 532,
|
||||
LeftAlt = 529,
|
||||
RightAlt = 533,
|
||||
LeftSuper = 530,
|
||||
RightSuper = 534,
|
||||
LeftCtrl = 527,
|
||||
MouseLeft = 641,
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum ResourceType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
string();
|
||||
string(const string&in);
|
||||
string& opAssign(const string&in);
|
||||
string& opAddAssign(const string&in);
|
||||
bool opEquals(const string&in) const;
|
||||
int opCmp(const string&in) const;
|
||||
string opAdd(const string&in) const;
|
||||
uint length() const;
|
||||
void resize(uint);
|
||||
bool isEmpty() const;
|
||||
uint8& opIndex(uint);
|
||||
const uint8& opIndex(uint) const;
|
||||
string& opAssign(double);
|
||||
string& opAddAssign(double);
|
||||
string opAdd(double) const;
|
||||
string opAdd_r(double) const;
|
||||
string& opAssign(float);
|
||||
string& opAddAssign(float);
|
||||
string opAdd(float) const;
|
||||
string opAdd_r(float) const;
|
||||
string& opAssign(int64);
|
||||
string& opAddAssign(int64);
|
||||
string opAdd(int64) const;
|
||||
string opAdd_r(int64) const;
|
||||
string& opAssign(uint64);
|
||||
string& opAddAssign(uint64);
|
||||
string opAdd(uint64) const;
|
||||
string opAdd_r(uint64) const;
|
||||
string& opAssign(bool);
|
||||
string& opAddAssign(bool);
|
||||
string opAdd(bool) const;
|
||||
string opAdd_r(bool) const;
|
||||
string substr(uint start = 0, int count = -1) const;
|
||||
int findFirst(const string&in, uint start = 0) const;
|
||||
int findFirstOf(const string&in, uint start = 0) const;
|
||||
int findFirstNotOf(const string&in, uint start = 0) const;
|
||||
int findLast(const string&in, int start = -1) const;
|
||||
int findLastOf(const string&in, int start = -1) const;
|
||||
int findLastNotOf(const string&in, int start = -1) const;
|
||||
void insert(uint pos, const string&in other);
|
||||
void erase(uint pos, int count = -1);
|
||||
}
|
||||
class array<T> {
|
||||
funcdef bool less(const T&in a, const T&in b);
|
||||
T[]@ array(int&in);
|
||||
T[]@ array(int&in, uint length);
|
||||
T[]@ array(int&in, uint length, const T&in value);
|
||||
T& opIndex(uint index);
|
||||
const T& opIndex(uint index) const;
|
||||
T[]& opAssign(const T[]&in);
|
||||
void insertAt(uint index, const T&in value);
|
||||
void insertAt(uint index, const T[]&inout arr);
|
||||
void insertLast(const T&in value);
|
||||
void removeAt(uint index);
|
||||
void removeLast();
|
||||
void removeRange(uint start, uint count);
|
||||
uint length() const;
|
||||
void reserve(uint length);
|
||||
void resize(uint length);
|
||||
void sortAsc();
|
||||
void sortAsc(uint startAt, uint count);
|
||||
void sortDesc();
|
||||
void sortDesc(uint startAt, uint count);
|
||||
void reverse();
|
||||
int find(const T&in value) const;
|
||||
int find(uint startAt, const T&in value) const;
|
||||
int findByRef(const T&in value) const;
|
||||
int findByRef(uint startAt, const T&in value) const;
|
||||
bool opEquals(const T[]&in) const;
|
||||
bool isEmpty() const;
|
||||
void sort(T[]::less&in, uint startAt = 0, uint count = uint ( - 1 ));
|
||||
funcdef bool less(const T&in, const T&in);
|
||||
}
|
||||
class dictionaryValue {
|
||||
~dictionaryValue();
|
||||
dictionaryValue();
|
||||
dictionaryValue& opAssign(const dictionaryValue&in);
|
||||
dictionaryValue& opHndlAssign(const ?&in);
|
||||
dictionaryValue& opHndlAssign(const dictionaryValue&in);
|
||||
dictionaryValue& opAssign(const ?&in);
|
||||
dictionaryValue& opAssign(double);
|
||||
dictionaryValue& opAssign(int64);
|
||||
void opCast(?&out);
|
||||
void opConv(?&out);
|
||||
int64 opConv();
|
||||
double opConv();
|
||||
}
|
||||
class dictionary {
|
||||
dictionary@ dictionary();
|
||||
dictionary& opAssign(const dictionary&in);
|
||||
void set(const string&in, const ?&in);
|
||||
bool get(const string&in, ?&out) const;
|
||||
void set(const string&in, const int64&in);
|
||||
bool get(const string&in, int64&out) const;
|
||||
void set(const string&in, const double&in);
|
||||
bool get(const string&in, double&out) const;
|
||||
bool exists(const string&in) const;
|
||||
bool isEmpty() const;
|
||||
uint getSize() const;
|
||||
bool delete(const string&in);
|
||||
void deleteAll();
|
||||
string[]@ getKeys() const;
|
||||
dictionaryValue& opIndex(const string&in);
|
||||
const dictionaryValue& opIndex(const string&in) const;
|
||||
}
|
||||
class ref {
|
||||
~ref();
|
||||
ref();
|
||||
ref(const ref&in);
|
||||
ref(const ?&in);
|
||||
void opCast(?&out);
|
||||
ref& opHndlAssign(const ref&in);
|
||||
ref& opHndlAssign(const ?&in);
|
||||
bool opEquals(const ref&in) const;
|
||||
bool opEquals(const ?&in) const;
|
||||
}
|
||||
class any {
|
||||
any@ any();
|
||||
any@ any(?&in);
|
||||
any@ any(const int64&in);
|
||||
any@ any(const double&in);
|
||||
any& opAssign(any&in);
|
||||
void store(?&in);
|
||||
void store(const int64&in);
|
||||
void store(const double&in);
|
||||
bool retrieve(?&out);
|
||||
bool retrieve(int64&out);
|
||||
bool retrieve(double&out);
|
||||
}
|
||||
class DockPanel {
|
||||
void onRender();
|
||||
}
|
||||
class ServiceScript {
|
||||
}
|
||||
class Entity {
|
||||
string get_name() const property;
|
||||
void set_name(string&in) property;
|
||||
int get_id() const property;
|
||||
Entity createChild(const string&in);
|
||||
bool get_isRoot() const property;
|
||||
void destroy();
|
||||
bool get_exists() const property;
|
||||
Entity get_parent() property;
|
||||
void set_parent(Entity) property;
|
||||
bool isDescendantOf(Entity);
|
||||
bool opEquals(const Entity&in) const;
|
||||
EntityChilds get_childs() const property;
|
||||
TransformComponent get_transform() const property;
|
||||
MeshComponent getMeshComponent();
|
||||
MeshComponent createMeshComponent();
|
||||
bool hasMeshComponent();
|
||||
void removeMeshComponent();
|
||||
ShaderComponent getShaderComponent();
|
||||
ShaderComponent createShaderComponent();
|
||||
bool hasShaderComponent();
|
||||
void removeShaderComponent();
|
||||
CameraComponent getCameraComponent();
|
||||
CameraComponent createCameraComponent();
|
||||
bool hasCameraComponent();
|
||||
void removeCameraComponent();
|
||||
}
|
||||
class EntityChilds {
|
||||
int get_count() const property;
|
||||
Entity opIndex(int) const;
|
||||
}
|
||||
class TransformComponent {
|
||||
vec3 get_position() const property;
|
||||
vec3 get_scale() const property;
|
||||
vec3 get_rotation() const property;
|
||||
void set_position(const vec3) property;
|
||||
void set_scale(const vec3) property;
|
||||
void set_rotation(const vec3) property;
|
||||
}
|
||||
class MeshComponent {
|
||||
bool get_isActive() const property;
|
||||
bool get_hasMesh() const property;
|
||||
void clear();
|
||||
string getMesh();
|
||||
void setMesh(string&in);
|
||||
void set_isActive(const bool) property;
|
||||
}
|
||||
class ShaderComponent {
|
||||
bool get_hasShader() const property;
|
||||
void clear();
|
||||
string getShader();
|
||||
void setShader(const string&in);
|
||||
}
|
||||
class CameraComponent {
|
||||
float get_fov() const property;
|
||||
float get_aspectRatio() const property;
|
||||
float get_nearZ() const property;
|
||||
float get_farZ() const property;
|
||||
void set_fov(float) property;
|
||||
void set_aspectRatio(float) property;
|
||||
void set_nearZ(float) property;
|
||||
void set_farZ(float) property;
|
||||
}
|
||||
class vec3 {
|
||||
vec3();
|
||||
vec3(float, float = 0, float = 0);
|
||||
vec3 opAdd(const vec3&in);
|
||||
vec3 opSub(const vec3&in) const;
|
||||
vec3 opNeg() const;
|
||||
vec3 opMul(float) const;
|
||||
vec3 opMul_r(float) const;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
}
|
||||
class quat {
|
||||
~quat();
|
||||
quat();
|
||||
quat(float, float, float, float);
|
||||
quat opMul(const quat&in) const;
|
||||
vec3 getEuler() const;
|
||||
void setEuler(vec3);
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
}
|
||||
class Transform {
|
||||
Transform();
|
||||
vec3 relative(vec3);
|
||||
vec3 position;
|
||||
vec3 scale;
|
||||
quat rotation;
|
||||
}
|
||||
class Camera {
|
||||
Camera();
|
||||
float fov;
|
||||
float aspect;
|
||||
float nearZ;
|
||||
float farZ;
|
||||
}
|
||||
class SceneCamera {
|
||||
SceneCamera();
|
||||
Camera camera;
|
||||
Transform transform;
|
||||
}
|
||||
class FrameBuffer {
|
||||
FrameBuffer();
|
||||
void clearRGBA(int, int, int, int);
|
||||
int get_height() const property;
|
||||
void resize(int, int);
|
||||
string get_name() const property;
|
||||
bool isValid();
|
||||
}
|
||||
class Environment {
|
||||
void render(FrameBuffer, SceneCamera&in);
|
||||
Entity getRootEntity();
|
||||
Entity getEntity(int);
|
||||
}
|
||||
string formatInt(int64 val, const string&in options = "", uint width = 0);
|
||||
string formatUInt(uint64 val, const string&in options = "", uint width = 0);
|
||||
string formatFloat(double val, const string&in options = "", uint width = 0, uint precision = 0);
|
||||
int64 parseInt(const string&in, uint base = 10, uint&out byteCount = 0);
|
||||
uint64 parseUInt(const string&in, uint base = 10, uint&out byteCount = 0);
|
||||
double parseFloat(const string&in, uint&out byteCount = 0);
|
||||
namespace Engine {
|
||||
Entity getRoot();
|
||||
}
|
||||
namespace UI {
|
||||
bool button(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
bool buttonCenter(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
bool buttonEnd(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
bool checkbox(const string&in, bool);
|
||||
}
|
||||
namespace UI {
|
||||
bool checkboxDisabled(const string&in, bool);
|
||||
}
|
||||
namespace UI {
|
||||
void drawFrameBuffer(FrameBuffer, int, int);
|
||||
}
|
||||
namespace UI {
|
||||
void drawFrameBufferCentered(FrameBuffer, int, int);
|
||||
}
|
||||
namespace UI {
|
||||
void drawIcon(const string&in, int);
|
||||
}
|
||||
namespace UI {
|
||||
void drawIconCentered(const string&in, int);
|
||||
}
|
||||
namespace UI {
|
||||
bool inputText(const string&in, const string&in, string&out);
|
||||
}
|
||||
namespace UI {
|
||||
bool isItemClicked(int);
|
||||
}
|
||||
namespace UI {
|
||||
bool isMouseDoubleClicked(int);
|
||||
}
|
||||
namespace UI {
|
||||
float magicSlider(const string&in, float, float);
|
||||
}
|
||||
namespace UI {
|
||||
vec3 magicSlider3(const string&in, vec3, float);
|
||||
}
|
||||
namespace UI {
|
||||
bool menuItem(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void menuItemDisabled(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void menuSpace(const string&in, any@, ReciverFunc@);
|
||||
}
|
||||
namespace UI {
|
||||
void sameline();
|
||||
}
|
||||
namespace UI {
|
||||
void separator();
|
||||
}
|
||||
namespace UI {
|
||||
void space();
|
||||
}
|
||||
namespace UI {
|
||||
void space(int, int = 10);
|
||||
}
|
||||
namespace UI {
|
||||
void text(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void textCenter(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void textColor(float, float, float, const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void textEnd(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void title(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void titleCenter(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void titleCenterY(const string&in, int);
|
||||
}
|
||||
namespace UI {
|
||||
void titleEnd(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
bool isKeyDown(key);
|
||||
}
|
||||
namespace UI {
|
||||
bool isKeyPressed(key);
|
||||
}
|
||||
namespace UI {
|
||||
bool isMouseDraggin(key);
|
||||
}
|
||||
namespace UI {
|
||||
bool isPannelActive();
|
||||
}
|
||||
namespace UI {
|
||||
float getMouseDragDeltaX();
|
||||
}
|
||||
namespace UI {
|
||||
float getMouseDragDeltaY();
|
||||
}
|
||||
namespace UI {
|
||||
float getMouseDeltaX();
|
||||
}
|
||||
namespace UI {
|
||||
float getMouseDeltaY();
|
||||
}
|
||||
namespace UI {
|
||||
int getAvailableSizeX();
|
||||
}
|
||||
namespace UI {
|
||||
int getAvailableSizeY();
|
||||
}
|
||||
namespace UI {
|
||||
void disablePannelPadding(bool);
|
||||
}
|
||||
namespace UI {
|
||||
int sliderInt(string&in, int, int, int);
|
||||
}
|
||||
namespace UI {
|
||||
float slider(string&in, float, float, float);
|
||||
}
|
||||
namespace Engine {
|
||||
FrameBuffer createRGBA8FrameBuffer(const string&in, int, int);
|
||||
}
|
||||
namespace Engine {
|
||||
FrameBuffer getFrameBuffer(const string&in);
|
||||
}
|
||||
namespace Engine {
|
||||
Environment getMainEnvironment();
|
||||
}
|
||||
namespace Engine {
|
||||
Environment createEnvironment();
|
||||
}
|
||||
namespace UI {
|
||||
void setupAutomaticColumns(int);
|
||||
}
|
||||
namespace UI {
|
||||
void setupColumns(int);
|
||||
}
|
||||
namespace UI {
|
||||
void endColumns();
|
||||
}
|
||||
namespace UI {
|
||||
void nextColumn();
|
||||
}
|
||||
namespace Resource {
|
||||
int getResourceCount(ResourceType, const string&in);
|
||||
}
|
||||
namespace Resource {
|
||||
string getResourceNameById(ResourceType, const string&in, int);
|
||||
}
|
||||
namespace Resource {
|
||||
string getResourcePathById(ResourceType, const string&in, int);
|
||||
}
|
||||
namespace Resource {
|
||||
int getDirCount(ResourceType, const string&in);
|
||||
}
|
||||
namespace Resource {
|
||||
string getDirPathById(ResourceType, const string&in, int);
|
||||
}
|
||||
namespace Resource {
|
||||
string getDirNameById(ResourceType, const string&in, int);
|
||||
}
|
||||
namespace Engine {
|
||||
void print(const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void treeNodeLeaf(const string&in, bool);
|
||||
}
|
||||
namespace UI {
|
||||
bool treeNode(const string&in, bool, any@, ReciverFunc@);
|
||||
}
|
||||
namespace UI {
|
||||
bool componentNode(const string&in, any@, ReciverFunc@);
|
||||
}
|
||||
namespace UI {
|
||||
bool componentNode_contextMenu(const string&in, any@, ReciverFunc@, ReciverFunc@);
|
||||
}
|
||||
namespace UI {
|
||||
void contextItemPopup(const string&in, any@, ReciverFunc@);
|
||||
}
|
||||
namespace UI {
|
||||
void contextMenuPopup(const string&in, any@, ReciverFunc@);
|
||||
}
|
||||
namespace UI {
|
||||
void modalPopup(const string&in, ReciverFunc@);
|
||||
}
|
||||
namespace UI {
|
||||
void simplePopup(const string&in, ReciverFunc@);
|
||||
}
|
||||
namespace UI {
|
||||
void openPopup(const string&in, any@);
|
||||
}
|
||||
namespace UI {
|
||||
void closePopup();
|
||||
}
|
||||
namespace UI {
|
||||
void dragDropSource(const string&in, any@, const string&in);
|
||||
}
|
||||
namespace UI {
|
||||
void dragDropTarget(const string&in, any@, TransferFunc@);
|
||||
}
|
33
roe/Editor/Services/ActiveEntity/ActiveEntity.as
Normal file
@ -0,0 +1,33 @@
|
||||
class ActiveEntity : ServiceScript {
|
||||
Entity entity;
|
||||
|
||||
void onInit() {
|
||||
entity = Engine::getMainEnvironment().getRootEntity();
|
||||
}
|
||||
|
||||
[ServiceAPI]
|
||||
Entity getActiveEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
[ServiceAPI]
|
||||
void setActiveEntity(Entity ent) {
|
||||
entity = ent;
|
||||
}
|
||||
|
||||
[ServiceAPI]
|
||||
void renameEntity(any@ data) {
|
||||
Entity entity;
|
||||
data.retrieve(entity);
|
||||
|
||||
string name = entity.name;
|
||||
if (UI::inputText("##RENAME", name, name)) {
|
||||
entity.name = name;
|
||||
}
|
||||
|
||||
UI::sameline();
|
||||
if (UI::button("Accept")) {
|
||||
UI::closePopup();
|
||||
}
|
||||
}
|
||||
}
|
403
roe/Editor/Services/ActiveEntity/as.predefined
Normal file
@ -0,0 +1,403 @@
|
||||
//This file was generated automatically
|
||||
funcdef void ReciverFunc(any@);
|
||||
funcdef void TransferFunc(any@, any@);
|
||||
enum key {
|
||||
A = 546,
|
||||
B = 547,
|
||||
C = 548,
|
||||
D = 549,
|
||||
E = 550,
|
||||
F = 551,
|
||||
G = 552,
|
||||
H = 553,
|
||||
I = 554,
|
||||
J = 555,
|
||||
K = 556,
|
||||
L = 557,
|
||||
M = 558,
|
||||
N = 559,
|
||||
O = 560,
|
||||
P = 561,
|
||||
Q = 562,
|
||||
R = 563,
|
||||
S = 564,
|
||||
T = 565,
|
||||
U = 566,
|
||||
V = 567,
|
||||
W = 568,
|
||||
X = 569,
|
||||
Y = 570,
|
||||
Z = 571,
|
||||
K0 = 536,
|
||||
K1 = 537,
|
||||
K2 = 538,
|
||||
K3 = 539,
|
||||
K4 = 540,
|
||||
K5 = 541,
|
||||
K6 = 542,
|
||||
K7 = 543,
|
||||
K8 = 544,
|
||||
K9 = 545,
|
||||
Tab = 512,
|
||||
Enter = 525,
|
||||
Escape = 526,
|
||||
Backspace = 523,
|
||||
Space = 524,
|
||||
Delete = 522,
|
||||
Insert = 521,
|
||||
Home = 519,
|
||||
End = 520,
|
||||
PageUp = 517,
|
||||
PageDown = 518,
|
||||
Right = 514,
|
||||
Up = 515,
|
||||
Down = 516,
|
||||
Left = 513,
|
||||
RightCtrl = 531,
|
||||
LeftShift = 528,
|
||||
RightShift = 532,
|
||||
LeftAlt = 529,
|
||||
RightAlt = 533,
|
||||
LeftSuper = 530,
|
||||
RightSuper = 534,
|
||||
LeftCtrl = 527,
|
||||
MouseLeft = 641,
|
||||
MouseRight = 642,
|
||||
MouseMiddle = 643
|
||||
}
|
||||
enum AssetType {
|
||||
None = 0,
|
||||
Shader = 2,
|
||||
Mesh = 1
|
||||
}
|
||||
class string {
|
||||
~string();
|
||||
string();
|
||||
string(const string&in);
|
||||
string& opAssign(const string&in);
|
||||
string& opAddAssign(const string&in);
|
||||
bool opEquals(const string&in) const;
|
||||
int opCmp(const string&in) const;
|
||||
string opAdd(const string&in) const;
|
||||
uint length() const;
|
||||
void resize(uint);
|
||||
bool isEmpty() const;
|
||||
uint8& opIndex(uint);
|
||||
const uint8& opIndex(uint) const;
|
||||
string& opAssign(double);
|
||||
string& opAddAssign(double);
|
||||
string opAdd(double) const;
|
||||
string opAdd_r(double) const;
|
||||
string& opAssign(float);
|
||||
string& opAddAssign(float);
|
||||
string opAdd(float) const;
|
||||
string opAdd_r(float) const;
|
||||
string& opAssign(int64);
|
||||
string& opAddAssign(int64);
|
||||
string opAdd(int64) const;
|
||||
string opAdd_r(int64) const;
|
||||
string& opAssign(uint64);
|
||||
string& opAddAssign(uint64);
|
||||
string opAdd(uint64) const;
|
||||
string opAdd_r(uint64) const;
|
||||
string& opAssign(bool);
|
||||
string& opAddAssign(bool);
|
||||
string opAdd(bool) const;
|
||||
string opAdd_r(bool) const;
|
||||
string substr(uint start = 0, int count = - 1) const;
|
||||
int findFirst(const string&in, uint start = 0) const;
|
||||
int findFirstOf(const string&in, uint start = 0) const;
|
||||
int findFirstNotOf(const string&in, uint start = 0) const;
|
||||
int findLast(const string&in, int start = - 1) const;
|
||||
int findLastOf(const string&in, int start = - 1) const;
|
||||
int findLastNotOf(const string&in, int start = - 1) const;
|
||||
void insert(uint pos, const string&in other);
|
||||
void erase(uint pos, int count = - 1);
|
||||
}
|
||||
class array<T> {
|
||||
funcdef bool less(const T&in a, const T&in b);
|
||||
T[]@ array(int&in);
|
||||
T[]@ array(int&in, uint length);
|
||||
T[]@ array(int&in, uint length, const T&in value);
|
||||
T& opIndex(uint index);
|
||||
const T& opIndex(uint index) const;
|
||||
T[]& opAssign(const T[]&in);
|
||||
void insertAt(uint index, const T&in value);
|
||||
void insertAt(uint index, const T[]&inout arr);
|
||||
void insertLast(const T&in value);
|
||||
void removeAt(uint index);
|
||||
void removeLast();
|
||||
void removeRange(uint start, uint count);
|
||||
uint length() const;
|
||||
void reserve(uint length);
|
||||
void resize(uint length);
|
||||
void sortAsc();
|
||||
void sortAsc(uint startAt, uint count);
|
||||
void sortDesc();
|
||||
void sortDesc(uint startAt, uint count);
|
||||
void reverse();
|
||||
int find(const T&in value) const;
|
||||
int find(uint startAt, const T&in value) const;
|
||||
int findByRef(const T&in value) const;
|
||||
int findByRef(uint startAt, const T&in value) const;
|
||||
bool opEquals(const T[]&in) const;
|
||||
bool isEmpty() const;
|
||||
void sort(T[]::less&in, uint startAt = 0, uint count = uint ( - 1 ));
|
||||
funcdef bool less(const T&in, const T&in);
|
||||
}
|
||||
class dictionaryValue {
|
||||
~dictionaryValue();
|
||||
dictionaryValue();
|
||||
dictionaryValue& opAssign(const dictionaryValue&in);
|
||||
dictionaryValue& opHndlAssign(const ?&in);
|
||||
dictionaryValue& opHndlAssign(const dictionaryValue&in);
|
||||
dictionaryValue& opAssign(const ?&in);
|
||||
dictionaryValue& opAssign(double);
|
||||
dictionaryValue& opAssign(int64);
|
||||
void opCast(?&out);
|
||||
void opConv(?&out);
|
||||
int64 opConv();
|
||||
double opConv();
|
||||
}
|
||||
class dictionary {
|
||||
dictionary@ dictionary();
|
||||
dictionary& opAssign(const dictionary&in);
|
||||
void set(const string&in, const ?&in);
|
||||
bool get(const string&in, ?&out) const;
|
||||
void set(const string&in, const int64&in);
|
||||
bool get(const string&in, int64&out) const;
|
||||
void set(const string&in, const double&in);
|
||||
bool get(const string&in, double&out) const;
|
||||
bool exists(const string&in) const;
|
||||
bool isEmpty() const;
|
||||
uint getSize() const;
|
||||
bool delete(const string&in);
|
||||
void deleteAll();
|
||||
string[]@ getKeys() const;
|
||||
dictionaryValue& opIndex(const string&in);
|
||||
const dictionaryValue& opIndex(const string&in) const;
|
||||
}
|
||||
class ref {
|
||||
~ref();
|
||||
ref();
|
||||
ref(const ref&in);
|
||||
ref(const ?&in);
|
||||
void opCast(?&out);
|
||||
ref& opHndlAssign(const ref&in);
|
||||
ref& opHndlAssign(const ?&in);
|
||||
bool opEquals(const ref&in) const;
|
||||
bool opEquals(const ?&in) const;
|
||||
}
|
||||
class any {
|
||||
any@ any();
|
||||
any@ any(?&in);
|
||||
any@ any(const int64&in);
|
||||
any@ any(const double&in);
|
||||
any& opAssign(any&in);
|
||||
void store(?&in);
|
||||
void store(const int64&in);
|
||||
void store(const double&in);
|
||||
bool retrieve(?&out);
|
||||
bool retrieve(int64&out);
|
||||
bool retrieve(double&out);
|
||||
}
|
||||
class DockPanel {
|
||||
void onRender();
|
||||
}
|
||||
class ServiceScript {
|
||||
}
|
||||
class Entity {
|
||||
string get_name() const property;
|
||||
void set_name(string&in) property;
|
||||
int get_id() const property;
|
||||
Entity createChild(const string&in);
|
||||
bool get_isRoot() const property;
|
||||
void destroy();
|
||||
bool get_exists() const property;
|
||||
Entity get_parent() property;
|
||||
void set_parent(Entity) property;
|
||||
bool isDescendantOf(Entity);
|
||||
bool opEquals(const Entity&in) const;
|
||||
EntityChilds get_childs() const property;
|
||||
TransformComponent get_transform() const property;
|
||||
MeshComponent getMeshComponent();
|
||||
MeshComponent createMeshComponent();
|
||||
bool hasMeshComponent();
|
||||
void removeMeshComponent();
|
||||
ShaderComponent getShaderComponent();
|
||||
ShaderComponent createShaderComponent();
|
||||
bool hasShaderComponent();
|
||||
void removeShaderComponent();
|
||||
CameraComponent getCameraComponent();
|
||||
CameraComponent createCameraComponent();
|
||||
bool hasCameraComponent();
|
||||
void removeCameraComponent();
|
||||
}
|
||||
class EntityChilds {
|
||||
int get_count() const property;
|
||||
Entity opIndex(int) const;
|
||||
}
|
||||
class TransformComponent {
|
||||
vec3 get_position() const property;
|
||||
vec3 get_scale() const property;
|
||||
vec3 get_rotation() const property;
|
||||
void set_position(const vec3) property;
|
||||
void set_scale(const vec3) property;
|
||||
void set_rotation(const vec3) property;
|
||||
}
|
||||
class MeshComponent {
|
||||
bool get_isActive() const property;
|
||||
bool get_hasMesh() const property;
|
||||
void clear();
|
||||
string getMesh();
|
||||
void setMesh(string&in);
|
||||
void set_isActive(const bool) property;
|
||||
}
|
||||
class ShaderComponent {
|
||||
bool get_hasShader() const property;
|
||||
void clear();
|
||||
string getShader();
|
||||
void setShader(const string&in);
|
||||
}
|
||||
class CameraComponent {
|
||||
float get_fov() const property;
|
||||
float get_aspectRatio() const property;
|
||||
float get_nearZ() const property;
|
||||
float get_farZ() const property;
|
||||
void set_fov(float) property;
|
||||
void set_aspectRatio(float) property;
|
||||
void set_nearZ(float) property;
|
||||
void set_farZ(float) property;
|
||||
}
|
||||
class vec3 {
|
||||
vec3();
|
||||
vec3(float, float = 0, float = 0);
|
||||
vec3 opAdd(const vec3&in);
|
||||
vec3 opSub(const vec3&in) const;
|
||||
vec3 opNeg() const;
|
||||
vec3 opMul(float) const;
|
||||
vec3 opMul_r(float) const;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
}
|
||||
class quat {
|
||||
~quat();
|
||||
quat();
|
||||
quat(float, float, float, float);
|
||||
quat opMul(const quat&in) const;
|
||||
vec3 getEuler() const;
|
||||
void setEuler(vec3);
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
}
|
||||
class Transform {
|
||||
Transform();
|
||||
vec3 relative(vec3);
|
||||
vec3 position;
|
||||
vec3 scale;
|
||||
quat rotation;
|
||||
}
|
||||
class Camera {
|
||||
Camera();
|
||||
float fov;
|
||||
float aspect;
|
||||
float nearZ;
|
||||
float farZ;
|
||||
}
|
||||
class SceneCamera {
|
||||
SceneCamera();
|
||||
Camera camera;
|
||||
Transform transform;
|
||||
}
|
||||
class FrameBuffer {
|
||||
FrameBuffer();
|
||||
void clearRGBA(int, int, int, int);
|
||||
int get_height() const property;
|
||||
void resize(int, int);
|
||||
string get_name() const property;
|
||||
bool isValid();
|
||||
}
|
||||
class Environment {
|
||||
void render(FrameBuffer, SceneCamera&in);
|
||||
Entity getRootEntity();
|
||||
Entity getEntity(int);
|
||||
}
|
||||
string formatInt(int64 val, const string&in options = "", uint width = 0);
|
||||
string formatUInt(uint64 val, const string&in options = "", uint width = 0);
|
||||
string formatFloat(double val, const string&in options = "", uint width = 0, uint precision = 0);
|
||||
int64 parseInt(const string&in, uint base = 10, uint&out byteCount = 0);
|
||||
uint64 parseUInt(const string&in, uint base = 10, uint&out byteCount = 0);
|
||||
double parseFloat(const string&in, uint&out byteCount = 0);
|
||||
namespace Engine { Entity getRoot(); }
|
||||
namespace UI { bool button(const string&in); }
|
||||
namespace UI { bool buttonCenter(const string&in); }
|
||||
namespace UI { bool buttonEnd(const string&in); }
|
||||
namespace UI { bool checkbox(const string&in, bool); }
|
||||
namespace UI { bool checkboxDisabled(const string&in, bool); }
|
||||
namespace UI { void drawFrameBuffer(FrameBuffer, int, int); }
|
||||
namespace UI { void drawFrameBufferCentered(FrameBuffer, int, int); }
|
||||
namespace UI { void drawIcon(const string&in, int); }
|
||||
namespace UI { void drawIconCentered(const string&in, int); }
|
||||
namespace UI { bool inputText(const string&in, const string&in, string&out); }
|
||||
namespace UI { bool isItemClicked(int); }
|
||||
namespace UI { bool isMouseDoubleClicked(int); }
|
||||
namespace UI { float magicSlider(const string&in, float, float); }
|
||||
namespace UI { vec3 magicSlider3(const string&in, vec3, float); }
|
||||
namespace UI { bool menuItem(const string&in); }
|
||||
namespace UI { void menuItemDisabled(const string&in); }
|
||||
namespace UI { void menuSpace(const string&in, any@, ReciverFunc@); }
|
||||
namespace UI { void sameline(); }
|
||||
namespace UI { void separator(); }
|
||||
namespace UI { void space(); }
|
||||
namespace UI { void space(int, int = 10); }
|
||||
namespace UI { void text(const string&in); }
|
||||
namespace UI { void textCenter(const string&in); }
|
||||
namespace UI { void textColor(float, float, float, const string&in); }
|
||||
namespace UI { void textEnd(const string&in); }
|
||||
namespace UI { void title(const string&in); }
|
||||
namespace UI { void titleCenter(const string&in); }
|
||||
namespace UI { void titleCenterY(const string&in, int); }
|
||||
namespace UI { void titleEnd(const string&in); }
|
||||
namespace UI { bool isKeyDown(key); }
|
||||
namespace UI { bool isKeyPressed(key); }
|
||||
namespace UI { bool isMouseDraggin(key); }
|
||||
namespace UI { bool isPannelActive(); }
|
||||
namespace UI { float getMouseDragDeltaX(); }
|
||||
namespace UI { float getMouseDragDeltaY(); }
|
||||
namespace UI { float getMouseDeltaX(); }
|
||||
namespace UI { float getMouseDeltaY(); }
|
||||
namespace UI { int getAvailableSizeX(); }
|
||||
namespace UI { int getAvailableSizeY(); }
|
||||
namespace UI { void disablePannelPadding(bool); }
|
||||
namespace UI { int sliderInt(string&in, int, int, int); }
|
||||
namespace UI { float slider(string&in, float, float, float); }
|
||||
namespace Engine { FrameBuffer createRGBA8FrameBuffer(const string&in, int, int); }
|
||||
namespace Engine { FrameBuffer getFrameBuffer(const string&in); }
|
||||
namespace Engine { Environment getMainEnvironment(); }
|
||||
namespace Engine { Environment createEnvironment(); }
|
||||
namespace UI { void setupAutomaticColumns(int); }
|
||||
namespace UI { void setupColumns(int); }
|
||||
namespace UI { void endColumns(); }
|
||||
namespace UI { void nextColumn(); }
|
||||
namespace Assets { int getAssetCount(AssetType, const string&in); }
|
||||
namespace Assets { string getAssetNameById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getAssetTypePathById(AssetType, const string&in, int); }
|
||||
namespace Assets { int getDirCount(AssetType, const string&in); }
|
||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||
namespace Engine { void print(const string&in); }
|
||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||
namespace UI { bool componentNode_contextMenu(const string&in, any@, ReciverFunc@, ReciverFunc@); }
|
||||
namespace UI { void contextItemPopup(const string&in, any@, ReciverFunc@); }
|
||||
namespace UI { void contextMenuPopup(const string&in, any@, ReciverFunc@); }
|
||||
namespace UI { void modalPopup(const string&in, ReciverFunc@); }
|
||||
namespace UI { void simplePopup(const string&in, ReciverFunc@); }
|
||||
namespace UI { void openPopup(const string&in, any@); }
|
||||
namespace UI { void closePopup(); }
|
||||
namespace UI { void dragDropSource(const string&in, any@, const string&in); }
|
||||
namespace UI { void dragDropTarget(const string&in, any@, TransferFunc@); }
|
@ -18,7 +18,7 @@ enum key
|
||||
};
|
||||
|
||||
//This file was generated automatically
|
||||
enum ResourceType {
|
||||
enum AssetType {
|
||||
Mesh = 1,
|
||||
Shader = 2
|
||||
}
|
||||
@ -343,18 +343,18 @@ namespace Engine {
|
||||
|
||||
namespace Resource {
|
||||
// Get the number of resources of a given type and category
|
||||
int getResourceCount(ResourceType type, const string& in category);
|
||||
int getAssetCount(AssetType type, const string& in category);
|
||||
// Get the name of a resource by type, category, and resource ID
|
||||
string getResourceNameById(ResourceType type, const string& in category, int id);
|
||||
string getAssetNameById(AssetType type, const string& in category, int id);
|
||||
// Get the file path of a resource by type, category, and resource ID
|
||||
string getResourcePathById(ResourceType type, const string& in category, int id);
|
||||
string getAssetTypePathById(AssetType type, const string& in category, int id);
|
||||
|
||||
// Get the number of directories of a given resource type and category
|
||||
int getDirCount(ResourceType type, const string& in category);
|
||||
int getDirCount(AssetType type, const string& in category);
|
||||
// Get the path of a directory by resource type, category, and directory ID
|
||||
string getDirPathById(ResourceType type, const string& in category, int id);
|
||||
string getDirPathById(AssetType type, const string& in category, int id);
|
||||
// Get the name of a directory by resource type, category, and directory ID
|
||||
string getDirNameById(ResourceType type, const string& in category, int id);
|
||||
string getDirNameById(AssetType type, const string& in category, int id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
# Blender 3.4.1
|
||||
# www.blender.org
|
||||
mtllib cube.mtl
|
||||
o Cube
|
||||
v -1.000000 -1.000000 1.000000
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v 1.000000 1.000000 1.000000
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 1.000000 -1.000000
|
||||
vn -1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 -0.0000 -1.0000
|
||||
vn 1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 -0.0000 1.0000
|
||||
vn -0.0000 -1.0000 -0.0000
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
vt 0.375000 0.000000
|
||||
vt 0.375000 1.000000
|
||||
vt 0.125000 0.750000
|
||||
vt 0.625000 0.000000
|
||||
vt 0.625000 1.000000
|
||||
vt 0.875000 0.750000
|
||||
vt 0.375000 0.250000
|
||||
vt 0.125000 0.500000
|
||||
vt 0.625000 0.250000
|
||||
vt 0.875000 0.500000
|
||||
vt 0.375000 0.750000
|
||||
vt 0.625000 0.750000
|
||||
vt 0.375000 0.500000
|
||||
vt 0.625000 0.500000
|
||||
s 0
|
||||
f 1/1/1 2/4/1 4/9/1 3/7/1
|
||||
f 3/7/2 4/9/2 8/14/2 7/13/2
|
||||
f 7/13/3 8/14/3 6/12/3 5/11/3
|
||||
f 5/11/4 6/12/4 2/5/4 1/2/4
|
||||
f 3/8/5 7/13/5 5/11/5 1/3/5
|
||||
f 8/14/6 4/10/6 2/6/6 6/12/6
|
@ -1,293 +0,0 @@
|
||||
{
|
||||
"scene": {
|
||||
"main_environment": {
|
||||
"entities": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Scene Root",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 0,
|
||||
"childrensUIDs": [
|
||||
2,
|
||||
6,
|
||||
7,
|
||||
5,
|
||||
9
|
||||
]
|
||||
},
|
||||
"hasMeshRenderComponent": false,
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Scenary",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": [
|
||||
3,
|
||||
4
|
||||
]
|
||||
},
|
||||
"hasMeshRenderComponent": false,
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Base",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 10.0,
|
||||
"y": 0.25,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 2,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Top",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 10.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 10.0,
|
||||
"y": 0.25,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 2,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "Enemy",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 9.0,
|
||||
"y": 5.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.25,
|
||||
"y": 1.0,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": true,
|
||||
"scriptComponent": {
|
||||
"scriptID": "PlayerScript"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Player",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": -9.0,
|
||||
"y": 5.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.25,
|
||||
"y": 1.0,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": true,
|
||||
"scriptComponent": {
|
||||
"scriptID": "PlayerScript"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"name": "Camera",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": -3.5067137105215809e-7,
|
||||
"y": 5.0,
|
||||
"z": -25.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.9999988079071045,
|
||||
"y": 1.0,
|
||||
"z": 0.9999988079071045
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": false,
|
||||
"hasCameraComponent": true,
|
||||
"cameraComponent": {
|
||||
"aspect": 1.789162516593933,
|
||||
"fov": 0.5714905858039856,
|
||||
"farZ": 100.0,
|
||||
"nearZ": 0.10000000149011612
|
||||
},
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "Ball",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 5.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.25,
|
||||
"y": 0.25,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": true,
|
||||
"scriptComponent": {
|
||||
"scriptID": "BallScript"
|
||||
}
|
||||
}
|
||||
],
|
||||
"mainCameraUID": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -1,201 +0,0 @@
|
||||
{
|
||||
"scene": {
|
||||
"main_environment": {
|
||||
"entities": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Scene Root",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 0,
|
||||
"childrensUIDs": [
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"hasMeshRenderComponent": false,
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Skull1",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": -1.1876044273376465,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/cube.obj",
|
||||
"shader": "assets/Shaders/SimpleShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": true,
|
||||
"textureBindingComponent": {
|
||||
"bindings": [
|
||||
{
|
||||
"texturePath": "assets/Skull.jpg",
|
||||
"bindingID": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Skull2",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 4.1646552085876469,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/skull.obj",
|
||||
"shader": "assets/Shaders/SimpleShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": true,
|
||||
"textureBindingComponent": {
|
||||
"bindings": [
|
||||
{
|
||||
"texturePath": "assets/test_texture.png",
|
||||
"bindingID": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Skull2 (duplicated)",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 1.608313798904419,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/skull.obj",
|
||||
"shader": "assets/Shaders/SimpleShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": true,
|
||||
"textureBindingComponent": {
|
||||
"bindings": [
|
||||
{
|
||||
"texturePath": "assets/Skull.jpg",
|
||||
"bindingID": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "Camera",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 1.266955018043518,
|
||||
"y": 1.3802015781402588,
|
||||
"z": 6.402083873748779
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.9999963045120239,
|
||||
"y": 1.0,
|
||||
"z": 0.9999963045120239
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.9979519844055176,
|
||||
"z": 0.0,
|
||||
"w": 0.06396745890378952
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": false,
|
||||
"hasCameraComponent": true,
|
||||
"cameraComponent": {
|
||||
"aspect": 1.6891757249832154,
|
||||
"fov": 0.8116129636764526,
|
||||
"farZ": 100.0,
|
||||
"nearZ": 0.10000000149011612
|
||||
},
|
||||
"hasTextureBindingComponent": false
|
||||
}
|
||||
],
|
||||
"mainCameraUID": 5
|
||||
}
|
||||
}
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
{
|
||||
"scene": {
|
||||
"main_environment": {
|
||||
"entities": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Scene Root",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 0,
|
||||
"childrensUIDs": [
|
||||
2
|
||||
]
|
||||
},
|
||||
"has_meshRenderComponent": false,
|
||||
"has_cameraComponent": false,
|
||||
"has_textureBindingComponent": false,
|
||||
"has_scriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Scene Root",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 0,
|
||||
"childrensUIDs": [
|
||||
2
|
||||
]
|
||||
},
|
||||
"has_meshRenderComponent": false,
|
||||
"has_cameraComponent": false,
|
||||
"has_textureBindingComponent": false,
|
||||
"has_scriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Camera",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 1.9156945943832398,
|
||||
"y": 11.272941589355469,
|
||||
"z": 45.95248794555664
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.000001072883606,
|
||||
"y": 1.0,
|
||||
"z": 1.000001072883606
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.9542083144187927,
|
||||
"z": 0.0,
|
||||
"w": 0.2991430163383484
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"has_meshRenderComponent": false,
|
||||
"has_cameraComponent": true,
|
||||
"cameraComponent": {
|
||||
"aspect": 1.6326905488967896,
|
||||
"fov": 0.8726646304130554,
|
||||
"farZ": 100.0,
|
||||
"nearZ": 0.10000000149011612
|
||||
},
|
||||
"has_textureBindingComponent": false,
|
||||
"has_scriptComponent": false
|
||||
}
|
||||
],
|
||||
"mainCameraUID": 2
|
||||
}
|
||||
}
|
||||
}
|
@ -1,293 +0,0 @@
|
||||
{
|
||||
"scene": {
|
||||
"main_environment": {
|
||||
"entities": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Scene Root",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 0,
|
||||
"childrensUIDs": [
|
||||
2,
|
||||
6,
|
||||
7,
|
||||
5,
|
||||
9
|
||||
]
|
||||
},
|
||||
"hasMeshRenderComponent": false,
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Scenary",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": [
|
||||
3,
|
||||
4
|
||||
]
|
||||
},
|
||||
"hasMeshRenderComponent": false,
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Base",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 10.0,
|
||||
"y": 0.25,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 2,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Top",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 10.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 10.0,
|
||||
"y": 0.25,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 2,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "Enemy",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 4.0,
|
||||
"y": 5.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.25,
|
||||
"y": 1.0,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": true,
|
||||
"scriptComponent": {
|
||||
"scriptID": "PlayerScript"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Player",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": -9.0,
|
||||
"y": 5.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.25,
|
||||
"y": 1.0,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": true,
|
||||
"scriptComponent": {
|
||||
"scriptID": "PlayerScript"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"name": "Camera",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": -3.5067137105215809e-7,
|
||||
"y": 5.0,
|
||||
"z": -25.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.9999988079071045,
|
||||
"y": 1.0,
|
||||
"z": 0.9999988079071045
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": false,
|
||||
"hasCameraComponent": true,
|
||||
"cameraComponent": {
|
||||
"aspect": 1.095049500465393,
|
||||
"fov": 0.5714905858039856,
|
||||
"farZ": 100.0,
|
||||
"nearZ": 0.10000000149011612
|
||||
},
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": false
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "Ball",
|
||||
"transform": {
|
||||
"position": {
|
||||
"x": 0.0,
|
||||
"y": 5.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.25,
|
||||
"y": 0.25,
|
||||
"z": 0.25
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"parentUID": 1,
|
||||
"childrensUIDs": []
|
||||
},
|
||||
"hasMeshRenderComponent": true,
|
||||
"meshRenderComponent": {
|
||||
"mesh": "assets/3dObjects/cube.obj",
|
||||
"shader": "assets/Shaders/FancyShader.glsl"
|
||||
},
|
||||
"hasCameraComponent": false,
|
||||
"hasTextureBindingComponent": false,
|
||||
"hasScriptComponent": true,
|
||||
"scriptComponent": {
|
||||
"scriptID": "BallScript"
|
||||
}
|
||||
}
|
||||
],
|
||||
"mainCameraUID": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
#type vertex
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec2 a_uv;
|
||||
layout(location = 2) in vec3 a_normal;
|
||||
|
||||
out vec2 textCoord;
|
||||
out vec3 worldNormal;
|
||||
|
||||
uniform mat4 u_viewMatrix;
|
||||
uniform mat4 u_worldMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_viewMatrix * u_worldMatrix * vec4(a_position,1.0);
|
||||
|
||||
mat3 normalMatrix = transpose(inverse(mat3(u_worldMatrix)));
|
||||
vec3 transformedNormal = normalize(normalMatrix * a_normal);
|
||||
|
||||
worldNormal = transformedNormal;
|
||||
textCoord = a_uv;
|
||||
}
|
||||
|
||||
#type fragment
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 1) out int objectID;
|
||||
|
||||
in vec2 textCoord;
|
||||
in vec3 worldNormal;
|
||||
|
||||
uniform int u_objectID;
|
||||
|
||||
void main()
|
||||
{
|
||||
float light = clamp(dot(worldNormal, normalize(vec3(1,2,3))), 0.1, 1.0);
|
||||
|
||||
fragColor = vec4(light, light, light, 1.0);
|
||||
objectID = u_objectID;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
#type vertex
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec2 a_uv;
|
||||
layout(location = 2) in vec3 a_normal;
|
||||
|
||||
out vec2 textCoord;
|
||||
out vec3 worldNormal;
|
||||
|
||||
uniform mat4 u_viewMatrix;
|
||||
uniform mat4 u_worldMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_viewMatrix * u_worldMatrix * vec4(a_position,1.0);
|
||||
|
||||
mat3 normalMatrix = transpose(inverse(mat3(u_worldMatrix)));
|
||||
vec3 transformedNormal = normalize(normalMatrix * a_normal);
|
||||
|
||||
worldNormal = transformedNormal;
|
||||
textCoord = a_uv;
|
||||
}
|
||||
|
||||
#type fragment
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 1) out int objectID;
|
||||
|
||||
in vec2 textCoord;
|
||||
in vec3 worldNormal;
|
||||
|
||||
uniform int u_objectID;
|
||||
|
||||
void main()
|
||||
{
|
||||
//float light = clamp(dot(worldNormal, normalize(vec3(1,2,3))), 0.1, 1.0);
|
||||
|
||||
fragColor = vec4(1,1,1, 1.0);
|
||||
objectID = u_objectID;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
#type vertex
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec2 a_uv;
|
||||
layout(location = 2) in vec3 a_normal;
|
||||
|
||||
out vec2 textCoord;
|
||||
out vec3 worldNormal;
|
||||
|
||||
uniform mat4 u_viewMatrix;
|
||||
uniform mat4 u_worldMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
//gl_Position = vec4(a_position, 1.0) * u_projectionMatrix * u_viewMatrix;
|
||||
gl_Position = u_viewMatrix * u_worldMatrix * vec4(a_position,1.0);
|
||||
|
||||
mat3 normalMatrix = transpose(inverse(mat3(u_worldMatrix)));
|
||||
vec3 transformedNormal = normalize(normalMatrix * a_normal);
|
||||
|
||||
worldNormal = transformedNormal;
|
||||
textCoord = a_uv;
|
||||
}
|
||||
|
||||
#type fragment
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 1) out int objectID;
|
||||
|
||||
in vec2 textCoord;
|
||||
in vec3 worldNormal;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform int u_objectID;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(u_texture, textCoord);
|
||||
objectID = u_objectID;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
#type vertex
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec2 a_uv;
|
||||
layout(location = 2) in vec3 a_normal;
|
||||
|
||||
out vec2 textCoord;
|
||||
out vec3 worldNormal;
|
||||
|
||||
uniform mat4 u_viewMatrix;
|
||||
uniform mat4 u_worldMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
//gl_Position = vec4(a_position, 1.0) * u_projectionMatrix * u_viewMatrix;
|
||||
gl_Position = u_viewMatrix * u_worldMatrix * vec4(a_position,1.0);
|
||||
|
||||
mat3 normalMatrix = transpose(inverse(mat3(u_worldMatrix)));
|
||||
vec3 transformedNormal = normalize(normalMatrix * a_normal);
|
||||
|
||||
worldNormal = transformedNormal;
|
||||
textCoord = a_uv;
|
||||
}
|
||||
|
||||
#type fragment
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 1) out int objectID;
|
||||
|
||||
in vec2 textCoord;
|
||||
in vec3 worldNormal;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform int u_objectID;
|
||||
|
||||
void main()
|
||||
{
|
||||
float v = clamp(dot(worldNormal, normalize(vec3(1,2,-3))), 0.1, 1.0);
|
||||
fragColor = texture(u_texture, textCoord) * v;
|
||||
objectID = u_objectID;
|
||||
}
|
Before Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 97 KiB |