MCPcopy Create free account
hub / github.com/carbonengine/trinity / ReadConstant

Function ReadConstant

trinity/Shader/Tr2EffectDescription.cpp:136–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136Tr2EffectConstant ReadConstant( EffectStream& stream, unsigned version )
137{
138 Tr2EffectConstant constant;
139 constant.name = BlueSharedString( stream.ReadString() );
140 constant.offset = stream.Read<uint32_t>();
141 constant.size = stream.Read<uint32_t>();
142 if( version < 11 )
143 {
144 uint8_t oldType = stream.Read<uint8_t>();
145 switch( oldType )
146 {
147 case 0:
148 constant.type = Tr2EffectConstant::FLOAT;
149 break;
150 case 1:
151 constant.type = Tr2EffectConstant::INT;
152 break;
153 case 2:
154 constant.type = Tr2EffectConstant::BOOL;
155 break;
156 default:
157 constant.type = Tr2EffectConstant::OTHER;
158 break;
159 }
160 }
161 else
162 {
163 constant.type = Tr2EffectConstant::Type( stream.Read<uint8_t>() );
164 }
165 constant.dimension = stream.Read<uint8_t>();
166 constant.elements = stream.Read<uint32_t>();
167 constant.isSRGB = stream.Read<uint8_t>() != 0;
168 constant.isAutoregister = stream.Read<uint8_t>() != 0;
169 return constant;
170}
171
172Tr2EffectResource ReadResource( EffectStream& stream, unsigned version )
173{

Callers 1

ReadInputFunction · 0.85

Calls 2

ReadStringMethod · 0.80
TypeEnum · 0.70

Tested by

no test coverage detected