1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 07:07:45 +00:00

merge in maprange header changes and move to common defs

This commit is contained in:
NotAdam 2019-04-11 19:09:19 +10:00
parent 24014a9a99
commit 600ce868d7
7 changed files with 16 additions and 894 deletions

View file

@ -218,9 +218,20 @@ struct LGB_MAPRANGE_HEADER :
public LGB_ENTRY_HEADER public LGB_ENTRY_HEADER
{ {
uint32_t type; uint32_t type;
uint16_t unknown2; uint8_t unknown2;
uint8_t unknown2_1;
uint16_t unknown3; uint16_t unknown3;
uint8_t unknown4[0x10]; uint32_t unknown5;
uint32_t mapId;
uint32_t offsetX, offsetY;
uint32_t unkInts[4];
uint16_t unkShort;
uint8_t unkFlag;
uint8_t unkFlag2;
uint8_t discoveryIndex;
uint8_t unkFlag3;
uint8_t unkFlag4;
uint8_t unknown4[0x09];
}; };
struct LGB_MAPRANGE_ENTRY : struct LGB_MAPRANGE_ENTRY :

View file

@ -1,404 +0,0 @@
#ifndef _LGB_H
#define _LGB_H
#include <cstring>
#include <memory>
#include <cstdint>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include "matrix4.h"
#include "vec3.h"
#include "sgb.h"
// garbage to skip model loading
extern bool ignoreModels;
// all credit to
// https://github.com/ufx/SaintCoinach/blob/master/SaintCoinach/Graphics/Lgb/
// this is simply their work ported to c++ since we dont c#
struct LGB_FILE;
struct LGB_FILE_HEADER;
struct LGB_GROUP;
struct LGB_GROUP_HEADER;
enum class LgbEntryType :
uint32_t
{
BgParts = 1,
Light = 3,
Vfx = 4,
PositionMarker = 5,
Gimmick = 6,
SharedGroup6 = 6,// secondary variable is set to 2
Sound = 7,
EventNpc = 8,
BattleNpc = 9,
Aetheryte = 12,
EnvSpace = 13,
Gathering = 14,
SharedGroup15 = 15,// secondary variable is set to 13
Treasure = 16,
Weapon = 39,
PopRange = 40,
ExitRange = 41,
MapRange = 43,
NaviMeshRange = 44,
EventObject = 45,
EnvLocation = 47,
EventRange = 49,
QuestMarker = 51,
CollisionBox = 57,
DoorRange = 58,
LineVfx = 59,
ClientPath = 65,
ServerPath = 66,
GimmickRange = 67,
TargetMarker = 68,
ChairMarker = 69,
ClickableRange = 70,
PrefetchRange = 71,
FateRange = 72,
SphereCastRange = 75,
};
struct LGB_ENTRY_HEADER
{
LgbEntryType type;
uint32_t unknown;
uint32_t nameOffset;
vec3 translation;
vec3 rotation;
vec3 scale;
};
class LGB_ENTRY
{
public:
char* m_buf;
uint32_t m_offset;
LGB_ENTRY_HEADER header;
LGB_ENTRY()
{
m_buf = nullptr;
m_offset = 0;
memset( &header, 0, sizeof( header ) );
};
LGB_ENTRY( char* buf, uint32_t offset )
{
m_buf = buf;
m_offset = offset;
header = *reinterpret_cast< LGB_ENTRY_HEADER* >( buf + offset );
};
const LgbEntryType getType() const
{
return header.type;
};
virtual ~LGB_ENTRY()
{
};
};
struct LGB_BGPARTS_HEADER :
public LGB_ENTRY_HEADER
{
uint32_t modelFileOffset;
uint32_t collisionFileOffset;
uint32_t unknown4;
uint32_t unknown5;
uint32_t unknown6;
uint32_t unknown7;
uint32_t unknown8;
uint32_t unknown9;
};
class LGB_BGPARTS_ENTRY :
public LGB_ENTRY
{
public:
LGB_BGPARTS_HEADER header;
std::string name;
std::string modelFileName;
std::string collisionFileName;
LGB_BGPARTS_ENTRY()
{
};
LGB_BGPARTS_ENTRY( char* buf, uint32_t offset ) :
LGB_ENTRY( buf, offset )
{
header = *reinterpret_cast<LGB_BGPARTS_HEADER*>( buf + offset );
name = std::string( buf + offset + header.nameOffset );
modelFileName = std::string( buf + offset + header.modelFileOffset );
collisionFileName = std::string( buf + offset + header.collisionFileOffset );
};
};
struct LGB_GIMMICK_HEADER :
public LGB_ENTRY_HEADER
{
uint32_t gimmickFileOffset;
char unknownBytes[100];
};
class LGB_GIMMICK_ENTRY :
public LGB_ENTRY
{
public:
LGB_GIMMICK_HEADER header;
std::string name;
std::string gimmickFileName;
LGB_GIMMICK_ENTRY( char* buf, uint32_t offset ) :
LGB_ENTRY( buf, offset )
{
header = *reinterpret_cast<LGB_GIMMICK_HEADER*>( buf + offset );
name = std::string( buf + offset + header.nameOffset );
gimmickFileName = std::string( buf + offset + header.gimmickFileOffset );
//std::cout << "\t " << gimmickFileName << " unknown: " << header.unknown << "\n";
};
};
struct LGB_ENPC_HEADER :
public LGB_ENTRY_HEADER
{
uint32_t enpcId;
uint8_t unknown1[0x24];
};
class LGB_ENPC_ENTRY :
public LGB_ENTRY
{
public:
LGB_ENPC_HEADER header;
std::string name;
LGB_ENPC_ENTRY( char* buf, uint32_t offset ) :
LGB_ENTRY( buf, offset )
{
header = *reinterpret_cast< LGB_ENPC_HEADER* >( buf + offset );
name = std::string( buf + offset + header.nameOffset );
//std::cout << "\t ENpc " << header.enpcId << " " << name << "\n";
};
};
struct LGB_EOBJ_HEADER :
public LGB_ENTRY_HEADER
{
uint32_t eobjId;
uint32_t levelHierachyId;
uint8_t unknown1[0xC];
};
class LGB_EOBJ_ENTRY :
public LGB_ENTRY
{
public:
LGB_EOBJ_HEADER header;
std::string name;
LGB_EOBJ_ENTRY( char* buf, uint32_t offset ) :
LGB_ENTRY( buf, offset )
{
header = *reinterpret_cast< LGB_EOBJ_HEADER* >( buf + offset );
//std::cout << "\t " << header.eobjId << " " << name << " unknown: " << header.unknown << "\n";
name = std::string( buf + offset + header.nameOffset );
};
};
struct LGB_MAPRANGE_HEADER :
public LGB_ENTRY_HEADER
{
uint32_t type;
uint8_t unknown2;
uint8_t unknown2_1;
uint16_t unknown3;
uint32_t unknown5;
uint32_t mapId;
uint32_t offsetX, offsetY;
uint32_t unkInts[4];
uint16_t unkShort;
uint8_t unkFlag;
uint8_t unkFlag2;
uint8_t discoveryIndex;
uint8_t unkFlag3;
uint8_t unkFlag4;
uint8_t unknown4[0x09];
};
struct LGB_MAPRANGE_ENTRY :
public LGB_ENTRY
{
public:
LGB_MAPRANGE_HEADER header;
std::string name;
LGB_MAPRANGE_ENTRY( char* buf, uint32_t offset ) :
LGB_ENTRY( buf, offset )
{
header = *reinterpret_cast< LGB_MAPRANGE_HEADER* >( buf + offset );
name = std::string( buf + offset + header.nameOffset );
};
};
struct LGB_POPRANGE_ENTRY :
public LGB_ENTRY
{
public:
LGB_MAPRANGE_HEADER header;
std::string name;
LGB_POPRANGE_ENTRY( char* buf, uint32_t offset ) :
LGB_ENTRY( buf, offset )
{
header = *reinterpret_cast< LGB_MAPRANGE_HEADER* >( buf + offset );
name = std::string( buf + offset + header.nameOffset );
};
};
struct LGB_GROUP_HEADER
{
uint32_t unknown;
int32_t groupNameOffset;
int32_t entriesOffset;
int32_t entryCount;
uint32_t unknown2;
uint32_t unknown3;
uint32_t unknown4;
uint32_t unknown5;
uint32_t unknown6;
uint32_t unknown7;
uint32_t unknown8;
uint32_t unknown9;
uint32_t unknown10;
};
struct LGB_GROUP
{
LGB_FILE* parent;
LGB_GROUP_HEADER header;
std::string name;
std::vector< std::shared_ptr< LGB_ENTRY > > entries;
LGB_GROUP( char* buf, LGB_FILE* parentStruct, uint32_t offset )
{
parent = parentStruct;
header = *reinterpret_cast< LGB_GROUP_HEADER* >( buf + offset );
name = std::string( buf + offset + header.groupNameOffset );
//entries.resize( header.entryCount );
//std::cout << name << "\n\t unknown: " << header.unknown << "\n";
const auto entriesOffset = offset + header.entriesOffset;
for( auto i = 0; i < header.entryCount; ++i )
{
const auto entryOffset = entriesOffset + *reinterpret_cast< int32_t* >( buf + ( entriesOffset + i * 4 ) );
try
{
const auto type = *reinterpret_cast<LgbEntryType*>( buf + entryOffset );
// garbage to skip model loading
if( type == LgbEntryType::PopRange )
{
entries.push_back( std::make_shared< LGB_POPRANGE_ENTRY >( buf, entryOffset ) );
}
else if( type == LgbEntryType::MapRange )
{
entries.push_back( std::make_shared< LGB_MAPRANGE_ENTRY >( buf, entryOffset ) );
}
/*
else
{
entries[i] = nullptr;
}
*/
}
catch( std::exception& e )
{
std::cout << name << " " << e.what() << std::endl;
}
}
};
};
struct LGB_FILE_HEADER
{
char magic[4]; // LGB 1
uint32_t fileSize;
uint32_t unknown;
char magic2[4]; // LGP1
uint32_t unknown2;
uint32_t unknown3;
uint32_t unknown4;
uint32_t unknown5;
int32_t groupCount;
};
struct LGB_FILE
{
LGB_FILE_HEADER header;
std::vector< LGB_GROUP > groups;
std::string name;
LGB_FILE( char* buf, const std::string& name )
{
header = *reinterpret_cast< LGB_FILE_HEADER* >( buf );
if( strncmp( &header.magic[ 0 ], "LGB1", 4 ) != 0 || strncmp( &header.magic2[ 0 ], "LGP1", 4 ) != 0 )
throw std::runtime_error( "Invalid LGB file!" );
//groups.resize(header.groupCount);
constexpr auto baseOffset = sizeof( header );
for( auto i = 0; i < header.groupCount; ++i )
{
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) );
const auto group = LGB_GROUP( buf, this, groupOffset );
groups.push_back( group );
}
};
};
/*
#if __cplusplus >= 201703L
#include <experimental/filesystem>
std::map<std::string, LGB_FILE> getLgbFiles( const std::string& dir )
{
namespace fs = std::experimental::filesystem;
std::map<std::string, LGB_FILE> fileMap;
for( const auto& path : fs::recursive_directory_iterator( dir ) )
{
if( path.path().extension() == ".lgb" )
{
const auto& strPath = path.path().string();
auto f = fopen( strPath.c_str(), "rb" );
fseek( f, 0, SEEK_END );
const auto size = ftell( f );
std::vector<char> bytes( size );
rewind( f );
fread( bytes.data(), 1, size, f );
fclose( f );
try
{
LGB_FILE lgbFile( bytes.data() );
fileMap.insert( std::make_pair( strPath, lgbFile ) );
}
catch( std::exception& e )
{
std::cout << "Unable to load " << strPath << std::endl;
}
}
}
return fileMap;
}
#endif
*/
#endif

View file

@ -13,9 +13,9 @@
#include <Util/Util.h> #include <Util/Util.h>
#include "pcb.h" #include <Exd/StructureDef/pcb.h>
#include "lgb.h" #include <Exd/StructureDef/lgb.h>
#include "sgb.h" #include <Exd/StructureDef/sgb.h>
#include "tex.h" #include "tex.h"
#include "tex_decode.h" #include "tex_decode.h"

View file

@ -1,111 +0,0 @@
#ifndef _MATRIX4_H
#define _MATRIX4_H
#include <cstdint>
#include <cmath>
// https://github.com/jpd002/Play--Framework/tree/master/include/math
struct matrix4
{
// 4x4
float grid[16];
matrix4()
{
memset( &grid[ 0 ], 0, sizeof( grid ) );
}
float operator()( int row, int col ) const
{
return grid[ ( row * 4 ) + col ];
}
float& operator()( int row, int col )
{
return grid[ ( row * 4 ) + col ];
}
static matrix4 rotateX( float angle )
{
matrix4 ret = matrix4();
ret( 0, 0 ) = 1.000000000f;
ret( 1, 1 ) = cos( angle );
ret( 1, 2 ) = -sin( angle );
ret( 2, 1 ) = sin( angle );
ret( 2, 2 ) = cos( angle );
ret( 3, 3 ) = 1.000000000f;
return ret;
}
static matrix4 rotateY( float angle )
{
matrix4 ret = matrix4();
ret( 0, 0 ) = cos( angle );
ret( 0, 2 ) = sin( angle );
ret( 1, 1 ) = 1.000000000f;
ret( 2, 0 ) = -sin( angle );
ret( 2, 2 ) = cos( angle );
ret( 3, 3 ) = 1.000000000f;
return ret;
}
static matrix4 rotateZ( float angle )
{
matrix4 ret = matrix4();
ret( 0, 0 ) = cos( angle );
ret( 0, 1 ) = -sin( angle );
ret( 1, 0 ) = sin( angle );
ret( 1, 1 ) = cos( angle );
ret( 2, 2 ) = 1.000000000f;
ret( 3, 3 ) = 1.000000000f;
return ret;
}
static matrix4 scale( float x, float y, float z )
{
matrix4 ret = matrix4();
ret( 0, 0 ) = x;
ret( 1, 1 ) = y;
ret( 2, 2 ) = z;
ret( 3, 3 ) = 1;
return ret;
}
static matrix4 translate( float x, float y, float z )
{
matrix4 ret = matrix4();
ret( 0, 0 ) = 1;
ret( 1, 1 ) = 1;
ret( 2, 2 ) = 1;
ret( 3, 3 ) = 1;
ret( 3, 0 ) = x;
ret( 3, 1 ) = y;
ret( 3, 2 ) = z;
return ret;
}
matrix4 operator*( const matrix4& rhs ) const
{
matrix4 ret;
for( unsigned int i = 0; i < 4; i++ )
{
ret( i, 0 ) =
( *this )( i, 0 ) * rhs( 0, 0 ) + ( *this )( i, 1 ) * rhs( 1, 0 ) + ( *this )( i, 2 ) * rhs( 2, 0 ) +
( *this )( i, 3 ) * rhs( 3, 0 );
ret( i, 1 ) =
( *this )( i, 0 ) * rhs( 0, 1 ) + ( *this )( i, 1 ) * rhs( 1, 1 ) + ( *this )( i, 2 ) * rhs( 2, 1 ) +
( *this )( i, 3 ) * rhs( 3, 1 );
ret( i, 2 ) =
( *this )( i, 0 ) * rhs( 0, 2 ) + ( *this )( i, 1 ) * rhs( 1, 2 ) + ( *this )( i, 2 ) * rhs( 2, 2 ) +
( *this )( i, 3 ) * rhs( 3, 2 );
ret( i, 3 ) =
( *this )( i, 0 ) * rhs( 0, 3 ) + ( *this )( i, 1 ) * rhs( 1, 3 ) + ( *this )( i, 2 ) * rhs( 2, 3 ) +
( *this )( i, 3 ) * rhs( 3, 3 );
}
return ret;
}
};
#endif

View file

@ -1,92 +0,0 @@
#ifndef _PCB_H
#define _PCB_H
#include <stdint.h>
#include <vector>
struct PCB_HEADER
{
uint32_t unknown_1;
uint32_t unknown_2;
uint32_t num_entries; // count starts at 0
uint32_t total_indices;
uint64_t padding;
};
struct PCB_BLOCK_HEADER
{
uint32_t type; // 0 for entry, 0x30 for group
uint32_t group_size; // when group size in bytes for the group block
// bounding box
float x;
float y;
float z;
float x1;
float y1;
float z1;
// number of vertices packed into 16 bit
uint16_t num_v16;
// number of indices
uint16_t num_indices;
// number of normal floar vertices
uint32_t num_vertices;
};
struct PCB_VERTEXDATA
{
float x;
float y;
float z;
};
struct PCB_INDEXDATA
{
uint8_t index[3];
uint8_t unknown[3];
uint8_t unknown1[6];
};
struct PCB_VERTEXDATAI16
{
uint16_t x;
uint16_t y;
uint16_t z;
};
struct PCB_BLOCK_DATA
{
std::vector< PCB_VERTEXDATA > vertices;
std::vector< PCB_VERTEXDATAI16 > vertices_i16;
std::vector< PCB_INDEXDATA > indices;
};
struct PCB_BLOCK_ENTRY
{
PCB_BLOCK_HEADER header;
PCB_BLOCK_DATA data;
};
struct PCB_FILE
{
PCB_HEADER header;
std::vector< PCB_BLOCK_ENTRY > entries;
};
struct PCB_LIST_ENTRY
{
uint32_t id;
float x, y, z, x2, y2, z2, rot;
};
struct PCB_LIST_BASE_ENTRY
{
float x, y, z, x2, y2, z2, rot;
};
struct PCB_LIST_FILE
{
uint32_t count;
PCB_LIST_BASE_ENTRY entry;
std::vector< PCB_LIST_ENTRY > entries;
};
#endif

View file

@ -1,222 +0,0 @@
#ifndef _SGB_H
#define _SGB_H
#include <cstring>
#include <memory>
#include <cstdint>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include "vec3.h"
// garbage to skip model loading
extern bool ignoreModels;
//
// ported from https://github.com/ufx/SaintCoinach/blob/master/SaintCoinach/Graphics/Sgb/SgbDataType.cs
struct SGB_FILE;
struct SGB_HEADER;
struct SGB_MODEL_ENTRY;
struct SGB_MODEL_HEADER;
struct SGB_GROUP;
struct SGB_GROUP_HEADER;
enum SgbDataType :
uint32_t
{
Unknown0008 = 0x0008,
Group = 0x0100,
};
enum SgbGroupEntryType :
uint32_t
{
Model = 0x01,
};
struct SGB_GROUP_HEADER
{
SgbDataType type;
int32_t nameOffset;
uint32_t unknown08;
uint32_t unknown0C;
uint32_t unknown10;
uint32_t unknown14;
uint32_t unknown18;
uint32_t unknown1C;
int32_t entryCount;
uint32_t unknown24;
uint32_t unknown28;
uint32_t unknown2C;
uint32_t unknown30;
uint32_t unknown34;
uint32_t unknown38;
uint32_t unknown3C;
uint32_t unknown40;
uint32_t unknown44;
};
struct SGB_GROUP_ENTRY
{
public:
char* m_buf;
uint32_t m_offset;
SGB_GROUP_ENTRY()
{
m_buf = nullptr;
m_offset = 0;
};
SGB_GROUP_ENTRY( char* buf, uint32_t offset )
{
m_buf = buf;
m_offset = offset;
};
virtual ~SGB_GROUP_ENTRY()
{
};
};
struct SGB_ENTRY_HEADER
{
SgbGroupEntryType type;
uint32_t unknown2;
int32_t nameOffset;
vec3 translation;
vec3 rotation;
vec3 scale;
};
struct SGB_MODEL_HEADER :
public SGB_ENTRY_HEADER
{
int32_t modelFileOffset;
int32_t collisionFileOffset;
};
struct SGB_MODEL_ENTRY :
public SGB_GROUP_ENTRY
{
SGB_MODEL_HEADER header;
SgbGroupEntryType type;
std::string name;
std::string modelFileName;
std::string collisionFileName;
SGB_MODEL_ENTRY( char* buf, uint32_t offset )
{
header = *reinterpret_cast< SGB_MODEL_HEADER* >( buf + offset );
name = std::string( buf + offset + header.nameOffset );
modelFileName = std::string( buf + offset + header.modelFileOffset );
collisionFileName = std::string( buf + offset + header.collisionFileOffset );
}
};
struct SGB_GROUP
{
SGB_GROUP_HEADER header;
std::string name;
SGB_FILE* parent;
std::vector< std::shared_ptr< SGB_GROUP_ENTRY > > entries;
SGB_GROUP( char* buf, SGB_FILE* file, uint32_t fileSize, uint32_t offset )
{
parent = file;
header = *reinterpret_cast< SGB_GROUP_HEADER* >( buf + offset );
name = std::string( buf + offset + header.nameOffset );
auto entriesOffset = offset + sizeof( header );
for( auto i = 0; i < header.entryCount; ++i )
{
auto entryOffset = entriesOffset + *reinterpret_cast< uint32_t* >( buf + ( entriesOffset + ( i * 4 ) ) );
if( entryOffset > fileSize )
throw std::runtime_error( "SGB_GROUP entry offset was larger than SGB file size!" );
auto type = *reinterpret_cast< uint32_t* >( buf + entryOffset );
if( type == SgbGroupEntryType::Model && !ignoreModels )
{
entries.push_back( std::make_shared< SGB_MODEL_ENTRY >( buf, entryOffset ) );
}
else
{
// std::cout << "\t\tUnknown SGB entry! Group: " << name << " type: " << type << " index: " << i << " entryOffset: " << entryOffset << "\n";
}
}
}
};
struct SGB_HEADER
{
char magic[4]; // SGB1
uint32_t fileSize;
uint32_t unknown1;
char magic2[4]; // SCN1
uint32_t unknown10;
int32_t sharedOffset;
uint32_t unknown18;
int32_t offset1C;
uint32_t unknown20;
uint32_t unknown24;
uint32_t unknown28;
uint32_t unknown2C;
uint32_t unknown30;
uint32_t unknown34;
uint32_t unknown38;
uint32_t unknown3C;
uint32_t unknown40;
uint32_t unknown44;
uint32_t unknown48;
uint32_t unknown4C;
uint32_t unknown50;
uint32_t unknown54;
};
struct SGB_FILE
{
SGB_HEADER header;
std::vector< SGB_GROUP > entries;
SGB_FILE()
{
memset( &header, 0, sizeof( header ) );
}
SGB_FILE( char* buf )
{
constexpr int baseOffset = 0x14;
header = *reinterpret_cast< SGB_HEADER* >( buf );
if( strncmp( &header.magic[ 0 ], "SGB1", 4 ) != 0 || strncmp( &header.magic2[ 0 ], "SCN1", 4 ) != 0 )
throw std::runtime_error( "Unable to load SGB File!" );
try
{
auto group = SGB_GROUP( buf, this, header.fileSize, baseOffset + header.sharedOffset );
entries.push_back( group );
auto group2 = SGB_GROUP( buf, this, header.fileSize, baseOffset + header.offset1C );
entries.push_back( group2 );
}
catch( std::exception& e )
{
std::cout << e.what() << "\n";
}
};
};
#endif // !_SGB_H

View file

@ -1,60 +0,0 @@
#ifndef _VEC3_H
#define _VEC3_H
#include <cstdint>
#include "matrix4.h"
struct vec3
{
float x, y, z;
vec3()
{
x = 0.0f;
y = 0.0f;
z = 0.0f;
}
vec3( float x, float y, float z )
{
this->x = x;
this->y = y;
this->z = z;
};
};
static vec3 operator*( const vec3& lhs, const matrix4& rhs )
{
vec3 ret;
ret.x = rhs( 0, 0 ) * lhs.x + rhs( 0, 1 ) * lhs.y + rhs( 0, 2 ) * lhs.z;
ret.y = rhs( 1, 0 ) * lhs.x + rhs( 1, 1 ) * lhs.y + rhs( 1, 2 ) * lhs.z;
ret.z = rhs( 2, 0 ) * lhs.x + rhs( 2, 1 ) * lhs.y + rhs( 2, 2 ) * lhs.z;
return ret;
};
static vec3 operator*( const vec3& lhs, float scalar )
{
return { lhs.x * scalar, lhs.y * scalar, lhs.z * scalar };
}
static vec3 operator+( const vec3& lhs, const vec3& rhs )
{
return { lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z };
}
static vec3 operator-( const vec3& lhs, const vec3& rhs )
{
return { lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z };
}
static vec3 operator/( const vec3& lhs, const vec3& rhs )
{
return { lhs.x / rhs.x, lhs.y / rhs.y, lhs.z / rhs.z };
}
static vec3 operator/( const vec3& lhs, float scalar )
{
return { lhs.x / scalar, lhs.y / scalar, lhs.z / scalar };
}
#endif