// // write_node // void ClientSidePrediction::write_node(VectorBuffer& message, Node& node) { // Write node ID message.WriteUInt(node.GetID()); // Write attributes write_network_attributes(node, message); // Write user variables const auto& vars = node.GetVars(); message.WriteVLE(vars.Size()); for (auto i = vars.Begin(); i != vars.End(); ++i) { message.WriteStringHash(i->first_); message.WriteVariant(i->second_); } // Write number of components message.WriteVLE(node.GetNumComponents()); // Write components const auto& components = node.GetComponents(); for (unsigned i = 0; i < components.Size(); ++i) { auto component = components[i]; write_component(message, *component); } }
// // write_component // void ClientSidePrediction::write_component(VectorBuffer& message, Component& component) { // Write ID message.WriteUInt(component.GetID()); // Write type message.WriteStringHash(component.GetType()); // Write attributes write_network_attributes(component, message); }
void Material::RefreshShaderParameterHash() { VectorBuffer temp; for (HashMap<StringHash, MaterialShaderParameter>::ConstIterator i = shaderParameters_.Begin(); i != shaderParameters_.End(); ++i) { temp.WriteStringHash(i->first_); temp.WriteVariant(i->second_.value_); } shaderParameterHash_ = 0; const unsigned char* data = temp.GetData(); unsigned dataSize = temp.GetSize(); for (unsigned i = 0; i < dataSize; ++i) shaderParameterHash_ = SDBMHash(shaderParameterHash_, data[i]); }