void ComputeNonbondedUtil::submitReductionData(BigReal *data, SubmitReduction *reduction) { reduction->item(REDUCTION_EXCLUSION_CHECKSUM) += data[exclChecksumIndex]; reduction->item(REDUCTION_PAIRLIST_WARNINGS) += data[pairlistWarningIndex]; reduction->item(REDUCTION_ELECT_ENERGY) += data[electEnergyIndex]; reduction->item(REDUCTION_ELECT_ENERGY_SLOW) += data[fullElectEnergyIndex]; reduction->item(REDUCTION_LJ_ENERGY) += data[vdwEnergyIndex]; // Ported by JLai reduction->item(REDUCTION_GO_NATIVE_ENERGY) += data[goNativeEnergyIndex]; reduction->item(REDUCTION_GO_NONNATIVE_ENERGY) += data[goNonnativeEnergyIndex]; // End of port -- JLai //fepb reduction->item(REDUCTION_ELECT_ENERGY_F) += data[electEnergyIndex_s]; reduction->item(REDUCTION_ELECT_ENERGY_SLOW_F) += data[fullElectEnergyIndex_s]; reduction->item(REDUCTION_LJ_ENERGY_F) += data[vdwEnergyIndex_s]; reduction->item(REDUCTION_ELECT_ENERGY_TI_1) += data[electEnergyIndex_ti_1]; reduction->item(REDUCTION_ELECT_ENERGY_SLOW_TI_1) += data[fullElectEnergyIndex_ti_1]; reduction->item(REDUCTION_LJ_ENERGY_TI_1) += data[vdwEnergyIndex_ti_1]; reduction->item(REDUCTION_ELECT_ENERGY_TI_2) += data[electEnergyIndex_ti_2]; reduction->item(REDUCTION_ELECT_ENERGY_SLOW_TI_2) += data[fullElectEnergyIndex_ti_2]; reduction->item(REDUCTION_LJ_ENERGY_TI_2) += data[vdwEnergyIndex_ti_2]; //fepe ADD_TENSOR(reduction,REDUCTION_VIRIAL_NBOND,data,virialIndex); ADD_TENSOR(reduction,REDUCTION_VIRIAL_SLOW,data,fullElectVirialIndex); ADD_VECTOR(reduction,REDUCTION_PAIR_VDW_FORCE,data,pairVDWForceIndex); ADD_VECTOR(reduction,REDUCTION_PAIR_ELECT_FORCE,data,pairElectForceIndex); reduction->item(REDUCTION_COMPUTE_CHECKSUM) += 1.; }
// send a broadcast pack indicating a player has respawned void multi_respawn_broadcast(net_player *np) { ubyte data[50],val; int packet_size = 0; ushort signature; vec3d pos; // broadcast the packet to all players Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); signature = Objects[np->m_player->objnum].net_signature; pos = Objects[np->m_player->objnum].pos; // build the header and add the opcode BUILD_HEADER(RESPAWN_NOTICE); val = RESPAWN_BROADCAST; ADD_DATA(val); // add the data for the respawn ADD_USHORT(signature); ADD_VECTOR(pos); ADD_SHORT(np->player_id); ADD_DATA(np->s_info.cur_primary_bank); ADD_DATA(np->s_info.cur_secondary_bank); ADD_DATA(np->s_info.cur_link_status); ADD_USHORT(np->s_info.ship_ets); ADD_STRING(np->p_info.p_objp->name); Assert( np->s_info.ship_ets != 0 ); // find dave or allender multi_io_send_to_all_reliable(data, packet_size); }
void TestSceneManager3::populate() { // Build the vertex array using the lowest toplevel voxel per corner. Note, we're // leaving in vertex duplication so each voxel can have its own normals and tex-coords. // This will increase our sene complexity, but give us more control, as well. std::vector<Vector3> vertsArray; std::vector<Vector2> coordsArray; for (int x = 0; x < _world->getWidth(); x++) { for (int y = 0; y < _world->getHeight(); y++) { #define ADD_VECTOR(xOff, yOff) do { \ vertsArray.push_back(getVectorForCorner(x + xOff, y + yOff)); \ coordsArray.push_back(Vector2(xOff, yOff)); \ } while (0) // Bottom left triangle. ADD_VECTOR(0, 0); ADD_VECTOR(1, 0); ADD_VECTOR(0, 1); // Top right triangle. ADD_VECTOR(0, 1); ADD_VECTOR(1, 0); ADD_VECTOR(1, 1); #undef ADD_VECTOR } } // Calculate normals for each of the vertices. Vector3 *verts = new Vector3[vertsArray.size()]; Vector3 *norms = new Vector3[vertsArray.size()]; for (int i = 0; i < vertsArray.size(); i+=3) { Vector3 one = vertsArray[i+1] - vertsArray[i+0]; Vector3 two = vertsArray[i+2] - vertsArray[i+1]; Vector3 normal = one.crossProduct(two); normal.normalize(); for (int j = 0; j < 3; j++) { verts[i+j] = vertsArray[i+j]; norms[i+j] = normal; } } Entity *entity = createEntity(new WorldEntity(verts, norms, vector_to_array(coordsArray), vertsArray.size()), "world"); entity->setMaterial(_materialManager->getOrLoadResource("grass")); getRootNode()->attach(entity); }