V-Gears 0
Free Final Fantasy VII engine.
OgreGenUtilites.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <Ogre.h>
21
25struct MeshData{
26
31
36
41};
42
46enum BPP{
47
51 BPP_4 = 0,
52
56 BPP_8 = 1,
57
61 BPP_BLACK = -1
62};
63
67struct TexForGen{
68
73
78
83
88
93
98
103
114 bool operator==(const TexForGen& i ) const{
115 return
117 && i.texture_y == texture_y
118 && i.palette_y == palette_y
119 && i.palette_x == palette_x
120 && i.bpp == bpp;
121 }
122};
123
124typedef std::vector< TexForGen > VectorTexForGen;
125
134void CreateTexture(
135 Vram* vram, const MeshData& mesh_data,
136 const Ogre::String& texture_file_name, const VectorTexForGen& textures
137);
138
148void CreateMaterial(
149 const Ogre::String& material_name, const Ogre::String& material_file_name,
150 const Ogre::String& texture_name, const Ogre::String& vertex_program,
151 const Ogre::String& fragment_program
152);
153
170 const Ogre::PixelBox& pixel_box, Vram* vram, const int start_x, const int start_y,
171 const int clut_x, const int clut_y, const int texture_x, const int texture_y,
172 const BPP bpp, const bool transparency
173);
174
184void AddTexture(
185 TexForGen& texture, const MeshData& data, VectorTexForGen& textures, Logger* logger
186);
187
195void AddTransparency(u32& colour, const bool transparency, const bool stp);
196
void CreateTextureFromVram(const Ogre::PixelBox &pixel_box, Vram *vram, const int start_x, const int start_y, const int clut_x, const int clut_y, const int texture_x, const int texture_y, const BPP bpp, const bool transparency)
Creates a material from video memory and adds it to the texture list.
Definition: OgreGenUtilites.cpp:19
void CreateMaterial(const Ogre::String &material_name, const Ogre::String &material_file_name, const Ogre::String &texture_name, const Ogre::String &vertex_program, const Ogre::String &fragment_program)
Creates a material and saves it to a file.
Definition: OgreGenUtilites.cpp:106
void CreateTexture(Vram *vram, const MeshData &mesh_data, const Ogre::String &texture_file_name, const VectorTexForGen &textures)
Creates a texture from video memory and saves it to a file.
Definition: OgreGenUtilites.cpp:70
std::vector< TexForGen > VectorTexForGen
Definition: OgreGenUtilites.h:124
void AddTexture(TexForGen &texture, const MeshData &data, VectorTexForGen &textures, Logger *logger)
Adds a texture to the list.
Definition: OgreGenUtilites.cpp:131
BPP
Bits per pixel modes.
Definition: OgreGenUtilites.h:46
@ BPP_BLACK
No color data, always black.
Definition: OgreGenUtilites.h:61
@ BPP_8
8 bits per pixel.
Definition: OgreGenUtilites.h:56
@ BPP_4
4 bites per pixel.
Definition: OgreGenUtilites.h:51
void AddTransparency(u32 &colour, const bool transparency, const bool stp)
Adds or removes a transparency to a colour.
Definition: OgreGenUtilites.cpp:164
unsigned int clut_x
Definition: TxzFileSerializer.h:0
unsigned int texture_x
Definition: TxzFileSerializer.h:2
unsigned int texture_y
Definition: TxzFileSerializer.h:3
unsigned int clut_y
Definition: TxzFileSerializer.h:1
Ogre::uint16 u16
Definition: TypeDefine.h:22
Ogre::uint32 u32
Definition: TypeDefine.h:23
Application logger utility.
Definition: Logger.h:59
Emulates a VRAM block.
Definition: Vram.h:27
Ogre::String String
Definition: TypeDefine.h:37
static HarcodedTextureInfo textures[]
World map hardcoded textures.
Definition: WorldmapModule.cpp:82
Mesh data.
Definition: OgreGenUtilites.h:25
int tex_height
Height of the texture for the mesh.
Definition: OgreGenUtilites.h:40
Ogre::String name
Mesh name.
Definition: OgreGenUtilites.h:30
int tex_width
Width of the texture for the mesh.
Definition: OgreGenUtilites.h:35
Texture data.
Definition: OgreGenUtilites.h:67
u16 texture_x
Texture X coordinate.
Definition: OgreGenUtilites.h:72
BPP bpp
BPP mode of the texture colour.
Definition: OgreGenUtilites.h:92
bool operator==(const TexForGen &i) const
Texture comparator.
Definition: OgreGenUtilites.h:114
int start_x
Definition: OgreGenUtilites.h:97
u16 palette_x
X coordinate of the texture palette.
Definition: OgreGenUtilites.h:87
int start_y
Definition: OgreGenUtilites.h:102
u16 palette_y
X coordinate of the texture palette.
Definition: OgreGenUtilites.h:82
u16 texture_y
Texture Y coordinate.
Definition: OgreGenUtilites.h:77