OpenUT99-Plus
Unreal Engine 1, rebuilt from scratch
Loading...
Searching...
No Matches
ut Namespace Reference

Classes

struct  Hit
struct  Node
struct  Surf
struct  Vert
struct  LightMap
struct  Model
struct  ReachSpec
struct  Level
struct  Vertex
class  Atlas
struct  LodMesh
struct  Object
class  PackageSet
class  PlayView
struct  GpuBatch
struct  Camera
class  Renderer
class  Props
struct  Axes
struct  LightInfo
struct  Placed
struct  Batch
struct  LiveBatch
struct  Spawn
struct  Scene
struct  ClassInfo
struct  Image
struct  Reader
struct  Import
struct  Export
struct  Package
struct  Property
struct  Vec3
class  Vfs
struct  Value
struct  Obj
struct  Local
struct  Function
class  Vm
struct  PlayerInput
class  World

Typedefs

using Ini = std::map<std::string, std::map<std::string, std::vector<std::string>>>
using BatchKey = std::tuple<const Export*, uint32_t>

Enumerations

enum  : uint32_t {
  PF_Invisible = 0x1 , PF_Masked = 0x2 , PF_Translucent = 0x4 , PF_Modulated = 0x40 ,
  PF_FakeBackdrop = 0x80 , PF_TwoSided = 0x100 , PF_Unlit = 0x400000 , PF_Portal = 0x4000000
}
enum class  PropType : uint8_t {
  Byte = 1 , Int , Bool , Float ,
  Object , Name , String , Class ,
  Array , Struct , Vector , Rotator ,
  Str , Map , FixedArray
}
enum class  VT : uint8_t {
  None , Byte , Int , Bool ,
  Float , Name , Str , Object ,
  Vector , Rotator , Struct
}
enum  : uint32_t {
  kParm = 0x80 , kOptionalParm = 0x10 , kOutParm = 0x100 , kSkipParm = 0x200 ,
  kReturnParm = 0x400
}
enum  : uint32_t { kFuncNative = 0x400 }
enum  : uint32_t { kFuncIterator = 0x4 , kFuncLatent = 0x8 , kStateAuto = 0x2 }

Functions

bool ray_cylinder (Vec3 a, Vec3 b, Vec3 c, float r, float h, float *t_hit, Vec3 *normal)
bool point_solid (const Model &m, Vec3 p)
Hit trace (const Model &m, Vec3 start, Vec3 end, Vec3 extent)
Hit trace_placed (const Model &m, Vec3 loc, Vec3 pivot, const float axes[3][3], Vec3 start, Vec3 end, Vec3 extent)
static std::string trim (const std::string &s)
Ini parse_ini (const std::string &text)
Ini read_ini (const std::string &path)
static Vec3 vec (Reader &r)
static uint64_t u64 (Reader &r)
static size_t count (Reader &r)
static void read_model_into (Reader &r, Model &m)
Model read_model (const Package &p, const Export &e)
static bool in (int32_t i, size_t n)
void validate_model (const Model &m)
size_t model_end (const Package &p, const Export &e)
Level read_level (const Package &p, const Export &e)
static float dot_sub (const Vec3 &p, const Vec3 &base, const Vec3 &axis)
std::vector< Vertex > node_triangles (const Model &m, const Node &n, int usize, int vsize)
static float dot (const Vec3 &a, const Vec3 &b)
static Vec3 cross (const Vec3 &a, const Vec3 &b)
Vec3 luxel_position (const Model &m, const Surf &s, const LightMap &lm, int i, int j)
int lightmap_lights (const Model &m, const LightMap &lm)
bool shadow_bit (const Model &m, const LightMap &lm, int light, int i, int j)
Vec3 light_colour (int hue, int saturation, int brightness)
float light_falloff (float d, int radius)
uint32_t style_flags (uint8_t style)
Vec3 face_normal (Vec3 a, Vec3 b, Vec3 c)
Vec3 unpack_vert (uint32_t v)
static Vec3 vec (Reader &r)
static size_t count (Reader &r)
static std::string name_at (const Package &p, int32_t i)
static LodMesh::AnimSeq read_seq (const Package &p, Reader &r)
LodMesh read_lod_mesh (const Package &p, const Export &e)
static std::string lower (std::string s)
static std::vector< std::string > export_groups (const Package &p, const Export &e)
static uint32_t crc32 (const uint8_t *p, size_t n, uint32_t c=0xFFFFFFFFu)
static void be32 (std::vector< uint8_t > &o, uint32_t v)
static void chunk (std::vector< uint8_t > &o, const char *tag, const std::vector< uint8_t > &body)
std::vector< uint8_t > encode_png (int width, int height, const std::vector< uint8_t > &rgba)
void write_png (const std::string &path, int width, int height, const std::vector< uint8_t > &rgba)
static void vertex_layout ()
static GLuint upload_texture (const Image &image)
static GLuint compile (GLenum type, const char *src)
static void view_projection (const Camera &c, float aspect, float out[16])
static void read_rotator (const Package &p, const Property &prop, Spawn &s)
static Axes rotation_axes (int32_t pitch, int32_t yaw, int32_t roll)
static Vec3 apply (const Axes &a, Vec3 v)
static LightInfo light_info (const Package &p, const Export &e)
static Vec3 zone_ambient (const Package &p, const Export &e)
static float dot3 (const Vec3 &a, const Vec3 &b)
static void bake (const Model &m, const Surf &s, const LightMap &lm, const std::vector< LightInfo > &lights, Vec3 ambient, Image &atlas, Placed at)
static size_t batch_for (PackageSet &set, Object tex, uint32_t flags, const char *name, std::map< BatchKey, size_t > &batch_of, Scene &scene)
static void add_mesh_actor (PackageSet &set, Props &props, std::map< const Export *, LodMesh > &meshes, Object actor, std::map< BatchKey, size_t > &batch_of, Scene &scene)
Scene load_scene (PackageSet &set, const std::string &map, bool mesh_actors)
size_t skip_script (const Package &p, size_t pos, uint32_t mem_size, std::vector< uint8_t > *memory)
ClassInfo read_class (const Package &p, const Export &cls)
static Image checker ()
Image texture_rgba (const Package &p, const Export &tex, bool masked)
static void utf8_append (std::string &s, uint32_t c)
static std::string cstring (Reader &r)
static const std::string & name_at (const Package &p, int32_t i)
Package parse_package (std::vector< uint8_t > data)
Package load_package (const std::string &path)
std::string object_name (const Package &p, int32_t ref)
std::vector< uint8_t > lazy_bytes (Reader &r, int version, size_t item_size)
std::vector< Property > read_properties (const Package &p, const Export &e, size_t *end)
int32_t prop_int (const Package &p, const Property &prop)
float prop_float (const Package &p, const Property &prop)
int32_t prop_ref (const Package &p, const Property &prop)
uint8_t prop_byte (const Package &p, const Property &prop)
std::string prop_string (const Package &p, const Property &prop)
Vec3 prop_vector (const Package &p, const Property &prop)
static std::string lower (std::string s)
static std::string first (const Ini &ini, const char *key, const char *fallback)
Function load_function (const Package &p, int32_t ref)
Function load_state (const Package &p, int32_t ref)
bool iequal (const std::string &a, const std::string &b)
void rotation_axes (const int32_t rot[3], float x[3], float y[3], float z[3])
PlayerInput scripted_input (float t, float dt)

Variables

static const char * kVert
static const char * kFrag
static const uint32_t kBatchFlags = PF_Masked | PF_Translucent | PF_Modulated | PF_TwoSided | PF_FakeBackdrop
static const size_t kSizes [] = {1, 2, 4, 12, 16}

Typedef Documentation

◆ BatchKey

using ut::BatchKey = std::tuple<const Export*, uint32_t>

◆ Ini

using ut::Ini = std::map<std::string, std::map<std::string, std::vector<std::string>>>

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
kFuncNative 

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
kFuncIterator 
kFuncLatent 
kStateAuto 

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
PF_Invisible 
PF_Masked 
PF_Translucent 
PF_Modulated 
PF_FakeBackdrop 
PF_TwoSided 
PF_Unlit 
PF_Portal 

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
kParm 
kOptionalParm 
kOutParm 
kSkipParm 
kReturnParm 

◆ PropType

enum class ut::PropType : uint8_t
strong
Enumerator
Byte 
Int 
Bool 
Float 
Object 
Name 
String 
Class 
Array 
Struct 
Vector 
Rotator 
Str 
Map 
FixedArray 

◆ VT

enum class ut::VT : uint8_t
strong
Enumerator
None 
Byte 
Int 
Bool 
Float 
Name 
Str 
Object 
Vector 
Rotator 
Struct 

Function Documentation

◆ add_mesh_actor()

void ut::add_mesh_actor ( PackageSet & set,
Props & props,
std::map< const Export *, LodMesh > & meshes,
Object actor,
std::map< BatchKey, size_t > & batch_of,
Scene & scene )
static

◆ apply()

Vec3 ut::apply ( const Axes & a,
Vec3 v )
static

◆ bake()

void ut::bake ( const Model & m,
const Surf & s,
const LightMap & lm,
const std::vector< LightInfo > & lights,
Vec3 ambient,
Image & atlas,
Placed at )
static

◆ batch_for()

size_t ut::batch_for ( PackageSet & set,
Object tex,
uint32_t flags,
const char * name,
std::map< BatchKey, size_t > & batch_of,
Scene & scene )
static

◆ be32()

void ut::be32 ( std::vector< uint8_t > & o,
uint32_t v )
static

◆ checker()

Image ut::checker ( )
static

◆ chunk()

void ut::chunk ( std::vector< uint8_t > & o,
const char * tag,
const std::vector< uint8_t > & body )
static

◆ compile()

GLuint ut::compile ( GLenum type,
const char * src )
static

◆ count() [1/2]

size_t ut::count ( Reader & r)
static

◆ count() [2/2]

size_t ut::count ( Reader & r)
static

◆ crc32()

uint32_t ut::crc32 ( const uint8_t * p,
size_t n,
uint32_t c = 0xFFFFFFFFu )
static

◆ cross()

Vec3 ut::cross ( const Vec3 & a,
const Vec3 & b )
static

◆ cstring()

std::string ut::cstring ( Reader & r)
static

◆ dot()

float ut::dot ( const Vec3 & a,
const Vec3 & b )
static

◆ dot3()

float ut::dot3 ( const Vec3 & a,
const Vec3 & b )
static

◆ dot_sub()

float ut::dot_sub ( const Vec3 & p,
const Vec3 & base,
const Vec3 & axis )
static

◆ encode_png()

std::vector< uint8_t > ut::encode_png ( int width,
int height,
const std::vector< uint8_t > & rgba )

◆ export_groups()

std::vector< std::string > ut::export_groups ( const Package & p,
const Export & e )
static

◆ face_normal()

Vec3 ut::face_normal ( Vec3 a,
Vec3 b,
Vec3 c )

◆ first()

std::string ut::first ( const Ini & ini,
const char * key,
const char * fallback )
static

◆ iequal()

bool ut::iequal ( const std::string & a,
const std::string & b )

◆ in()

bool ut::in ( int32_t i,
size_t n )
static

◆ lazy_bytes()

std::vector< uint8_t > ut::lazy_bytes ( Reader & r,
int version,
size_t item_size )

◆ light_colour()

Vec3 ut::light_colour ( int hue,
int saturation,
int brightness )

◆ light_falloff()

float ut::light_falloff ( float d,
int radius )

◆ light_info()

LightInfo ut::light_info ( const Package & p,
const Export & e )
static

◆ lightmap_lights()

int ut::lightmap_lights ( const Model & m,
const LightMap & lm )

◆ load_function()

Function ut::load_function ( const Package & p,
int32_t ref )

◆ load_package()

Package ut::load_package ( const std::string & path)

◆ load_scene()

Scene ut::load_scene ( PackageSet & set,
const std::string & map,
bool mesh_actors )

◆ load_state()

Function ut::load_state ( const Package & p,
int32_t ref )

◆ lower() [1/2]

std::string ut::lower ( std::string s)
static

◆ lower() [2/2]

std::string ut::lower ( std::string s)
static

◆ luxel_position()

Vec3 ut::luxel_position ( const Model & m,
const Surf & s,
const LightMap & lm,
int i,
int j )

◆ model_end()

size_t ut::model_end ( const Package & p,
const Export & e )

◆ name_at() [1/2]

std::string ut::name_at ( const Package & p,
int32_t i )
static

◆ name_at() [2/2]

const std::string & ut::name_at ( const Package & p,
int32_t i )
static

◆ node_triangles()

std::vector< Vertex > ut::node_triangles ( const Model & m,
const Node & n,
int usize,
int vsize )

◆ object_name()

std::string ut::object_name ( const Package & p,
int32_t ref )

◆ parse_ini()

Ini ut::parse_ini ( const std::string & text)

◆ parse_package()

Package ut::parse_package ( std::vector< uint8_t > data)

◆ point_solid()

bool ut::point_solid ( const Model & m,
Vec3 p )

◆ prop_byte()

uint8_t ut::prop_byte ( const Package & p,
const Property & prop )

◆ prop_float()

float ut::prop_float ( const Package & p,
const Property & prop )

◆ prop_int()

int32_t ut::prop_int ( const Package & p,
const Property & prop )

◆ prop_ref()

int32_t ut::prop_ref ( const Package & p,
const Property & prop )

◆ prop_string()

std::string ut::prop_string ( const Package & p,
const Property & prop )

◆ prop_vector()

Vec3 ut::prop_vector ( const Package & p,
const Property & prop )

◆ ray_cylinder()

bool ut::ray_cylinder ( Vec3 a,
Vec3 b,
Vec3 c,
float r,
float h,
float * t_hit,
Vec3 * normal )

◆ read_class()

ClassInfo ut::read_class ( const Package & p,
const Export & cls )

◆ read_ini()

Ini ut::read_ini ( const std::string & path)

◆ read_level()

Level ut::read_level ( const Package & p,
const Export & e )

◆ read_lod_mesh()

LodMesh ut::read_lod_mesh ( const Package & p,
const Export & e )

◆ read_model()

Model ut::read_model ( const Package & p,
const Export & e )

◆ read_model_into()

void ut::read_model_into ( Reader & r,
Model & m )
static

◆ read_properties()

std::vector< Property > ut::read_properties ( const Package & p,
const Export & e,
size_t * end )

◆ read_rotator()

void ut::read_rotator ( const Package & p,
const Property & prop,
Spawn & s )
static

◆ read_seq()

LodMesh::AnimSeq ut::read_seq ( const Package & p,
Reader & r )
static

◆ rotation_axes() [1/2]

void ut::rotation_axes ( const int32_t rot[3],
float x[3],
float y[3],
float z[3] )

◆ rotation_axes() [2/2]

Axes ut::rotation_axes ( int32_t pitch,
int32_t yaw,
int32_t roll )
static

◆ scripted_input()

PlayerInput ut::scripted_input ( float t,
float dt )

◆ shadow_bit()

bool ut::shadow_bit ( const Model & m,
const LightMap & lm,
int light,
int i,
int j )

◆ skip_script()

size_t ut::skip_script ( const Package & p,
size_t pos,
uint32_t mem_size,
std::vector< uint8_t > * memory )

◆ style_flags()

uint32_t ut::style_flags ( uint8_t style)

◆ texture_rgba()

Image ut::texture_rgba ( const Package & p,
const Export & tex,
bool masked )

◆ trace()

Hit ut::trace ( const Model & m,
Vec3 start,
Vec3 end,
Vec3 extent )

◆ trace_placed()

Hit ut::trace_placed ( const Model & m,
Vec3 loc,
Vec3 pivot,
const float axes[3][3],
Vec3 start,
Vec3 end,
Vec3 extent )

◆ trim()

std::string ut::trim ( const std::string & s)
static

◆ u64()

uint64_t ut::u64 ( Reader & r)
static

◆ unpack_vert()

Vec3 ut::unpack_vert ( uint32_t v)

◆ upload_texture()

GLuint ut::upload_texture ( const Image & image)
static

◆ utf8_append()

void ut::utf8_append ( std::string & s,
uint32_t c )
static

◆ validate_model()

void ut::validate_model ( const Model & m)

◆ vec() [1/2]

Vec3 ut::vec ( Reader & r)
static

◆ vec() [2/2]

Vec3 ut::vec ( Reader & r)
static

◆ vertex_layout()

void ut::vertex_layout ( )
static

◆ view_projection()

void ut::view_projection ( const Camera & c,
float aspect,
float out[16] )
static

◆ write_png()

void ut::write_png ( const std::string & path,
int width,
int height,
const std::vector< uint8_t > & rgba )

◆ zone_ambient()

Vec3 ut::zone_ambient ( const Package & p,
const Export & e )
static

Variable Documentation

◆ kBatchFlags

const uint32_t ut::kBatchFlags = PF_Masked | PF_Translucent | PF_Modulated | PF_TwoSided | PF_FakeBackdrop
static

◆ kFrag

const char* ut::kFrag
static
Initial value:
= R"(#version 330 core
in vec2 v_uv;
in vec2 v_luv;
uniform sampler2D tex;
uniform sampler2D lightmap;
uniform bool masked;
uniform bool lit;
out vec4 colour;
void main() {
vec4 c = texture(tex, v_uv);
if (masked && c.a < 0.5) discard;
vec3 light = lit ? 2.0 * texture(lightmap, v_luv).rgb : vec3(1.0);
colour = vec4(c.rgb * light, 1.0);
})"

◆ kSizes

const size_t ut::kSizes[] = {1, 2, 4, 12, 16}
static

◆ kVert

const char* ut::kVert
static
Initial value:
= R"(#version 330 core
layout(location = 0) in vec3 pos;
layout(location = 1) in vec2 uv;
layout(location = 2) in vec2 luv;
uniform mat4 mvp;
out vec2 v_uv;
out vec2 v_luv;
void main() { v_uv = uv; v_luv = luv; gl_Position = mvp * vec4(pos, 1.0); })"