Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
vchannel.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program 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** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/* $Header: /Commando/Code/Tools/max2w3d/vchannel.h 8 10/30/00 6:56p Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando Tools - W3D export *
25 * *
26 * $Archive:: /Commando/Code/Tools/max2w3d/vchannel.h $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 10/30/00 5:25p $*
31 * *
32 * $Revision:: 8 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
37
38
39#ifndef VCHANNEL_H
40#define VCHANNEL_H
41
42#ifndef ALWAYS_H
43#include "always.h"
44#endif
45
46#ifndef BITTYPE_H
47#include "bittype.h"
48#endif
49
50#ifndef CHUNKIO_H
51#include "chunkio.h"
52#endif
53
54#ifndef W3D_FILE_H
55#include "w3d_file.h"
56#endif
57
58
59class BitChannelClass;
60
61/*
62
63 This class is a container for an array of vectors. It will keep
64 track of whether the entire array of vectors is zero, and if not
65 where the non-zero vectors begin and end.
66
67 VectorChannelClass is used in exporting motion. Motion data
68 is broken into separate channels for X, Y, Z, and orientation.
69 Then if any of the channels are empty, they don't have to be stored.
70 The X,Y,Z channels all contain one-dimensional vectors and the
71 orientation channel contains four-dimensional vectors.
72
73*/
74// for compression
75#define DEFAULT_LOSSY_ERROR_TOLERANCE (0.0001)
76#define PACKETS_ALL_USEFUL (0xFFFFFFFF)
77
79{
80public:
81
82 VectorChannelClass(uint32 id,int maxframes,uint32 flags,int vectorlength,float32 * identvec);
84
85 void Set_Vector(int framenumber,float32 * vector);
86 float * Get_Vector(int frameidx);
87 bool Is_Empty(void) { return IsEmpty; }
88 void SetSaveOptions(bool compress, int flavor, float Terr, float Rerr, bool reduce, int reduce_percent);
89 bool Save(ChunkSaveClass & csave, BitChannelClass *binmov);
91
92private:
93
94 uint32 ID;
95 uint32 Flags;
96 int MaxFrames;
97 int VectorLen;
98 bool IsEmpty;
99
100 float32 * IdentVect;
101 float32 * Data;
102 int Begin;
103 int End;
104
105 // Save Options
106
107 bool ReduceAnimation;
108 int ReduceAnimationPercent;
109 bool CompressAnimation;
110 int CompressAnimationFlavor;
111 float CompressAnimationTranslationError;
112 float CompressAnimationRotationError;
113
114 // Write a single value
115 void set_value(int framenum,int vindex,float32 val);
116
117 // Read a single value
118 float32 get_value(int framenum,int vindex);
119
120 // Test a vector against the "identity" vector
121 bool is_identity(float32 * vec);
122
123 // This function finds the start and end of the "non-identity" data
124 void compute_range(void);
125
126 // compress functions
127 void compress(W3dTimeCodedAnimChannelStruct * c);
128 float compress(int filter_index, float scale, float value1, float *indata, unsigned char *pPacket, float *outdata);
129 float test_compress(int filter_index, float scale, float value1, float *indata, float *outdata);
130 uint32 find_useless_packet(W3dTimeCodedAnimChannelStruct * c, double tolerance);
131 uint32 find_useless_packetQ(W3dTimeCodedAnimChannelStruct * c, double tolerance);
132 uint32 find_least_useful_packet(W3dTimeCodedAnimChannelStruct *c);
133 uint32 find_least_useful_packetQ(W3dTimeCodedAnimChannelStruct *c);
134 void remove_packet(W3dTimeCodedAnimChannelStruct * c, uint32 packet_idx);
135 bool SaveTimeCoded(ChunkSaveClass & csave, BitChannelClass *binmov);
136 bool SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelClass *binmov);
137
138};
139
140#endif /*VCHANNEL_H*/
Color scale(const Color &a, const Color &b)
Definition GameMtl.cpp:722
unsigned long uint32
Definition bittype.h:46
float float32
Definition bittype.h:54
bool Is_Empty(void)
Definition vchannel.h:87
VectorChannelClass(uint32 id, int maxframes, uint32 flags, int vectorlength, float32 *identvec)
Definition vchannel.cpp:76
float * Get_Vector(int frameidx)
Definition vchannel.cpp:158
void ClearInvisibleData(BitChannelClass *vis)
Definition vchannel.cpp:684
void SetSaveOptions(bool compress, int flavor, float Terr, float Rerr, bool reduce, int reduce_percent)
Definition vchannel.cpp:667
void Set_Vector(int framenumber, float32 *vector)
Definition vchannel.cpp:144
bool Save(ChunkSaveClass &csave, BitChannelClass *binmov)
Definition vchannel.cpp:578