void SDLNet_UDP_AddSocket(SDLNet_SocketSet set, UDPsocket socket) { //fprintf(stderr, "SDLNet_UDP_AddSocket\n"); SocketSet_Impl* impl = ToImpl(set); UDPsocket_Impl** head = &impl->udp_sockets_head; UDPsocket_Impl** tail = &impl->udp_sockets_tail; SListAppend(head, tail, ToImpl(socket)); }
// Constructor. Scene::Scene(bePhysics::Device *device, const SceneDesc &desc) : m_pScene( CreateScene( *ToImpl(device), ToAPI( desc, ToImpl(*device)->getTolerancesScale(), ToImpl(*device).GetCPUDispatcher(), ToImpl(*device).GetGPUDispatcher() ) ) ) { }
int SDLNet_UDP_Recv(UDPsocket socket, UDPpacket* result) { //fprintf(stderr, "SDLNet_UDP_Recv [socket=%p, maxlen=%u]\n", socket, result->maxlen); UDPsocket_Impl* impl = ToImpl(socket); for (int i = 1; i >= 0; --i) { // check in reverse order if (impl->channels[i].packet_head) { UDPpacket* packet = impl->channels[i].packet_head; //fprintf(stderr, " ... found packet on channel=%u\n", i); if (packet->len > result->maxlen) { fprintf(stderr, "need to support partial recv!\n"); return -1; } result->address = impl->channels[i].address; result->channel = i; memcpy(result->data, packet->data, packet->len); result->len = packet->len; SListPopFront(&impl->channels[i].packet_head, &impl->channels[i].packet_tail); FreePacket(packet); return 1; } } return -1; }
void SDLNet_UDP_Bind(UDPsocket socket, int channel, IPaddress* address) { //fprintf(stderr, "SDLNet_UDP_Bind (socket=%p, channel=%u, host=%u, port=%u)\n", // socket, channel, address->host, address->port); if (channel > 1) { fprintf(stderr, "SDLNet_UDP_Bind only supports 2 channels!\n"); return; } UDPsocket_Impl* impl = ToImpl(socket); impl->channels[channel].address = *address; }
// Constructor. CharacterSceneController::CharacterSceneController(SceneController *pScene) : m_scene( LEAN_ASSERT_NOT_NULL(pScene) ), m_characterScene( lean::bind_resource( new PX3::CharacterScene( PX3::CreateCharacterScene(&ToImpl(*pScene->GetScene())->getPhysics()) ) ) ), m_pAttachedTo() { }
/// Draws the given pass. void ProcessingEffectDriver::Render(const QueuedPass *pass_, const void *pProcessor, const Perspective *pPerspective, lean::vcallable<DrawJobSignature> &drawJob, beGraphics::StateManager &stateManager_, const beGraphics::DeviceContext &context) const { const PipelineEffectBinderPass* pass = static_cast<const PipelineEffectBinderPass*>(pass_); beGraphics::Any::StateManager &stateManager = ToImpl(stateManager_); ID3D11DeviceContext *contextDX = ToImpl(context); // Prepare if (pPerspective) m_perspectiveBinder.Apply(*pPerspective, stateManager, contextDX); // Render passes for (uint4 step = 0, nextStep; const StateEffectBinderPass *statePass = statePass = pass->GetPass(step); step = nextStep) { nextStep = step + 1; uint4 passID = statePass->GetPassID(); uint4 nextPassID = passID; DX11::Pipe *pPipe = nullptr; uint4 outIndex = 0; if (pPerspective) { pPipe = ToImpl(pPerspective->GetPipe()); outIndex = pPerspective->GetDesc().OutputIndex; } if (m_pipeBinder.Apply(nextPassID, pPipe, outIndex, pProcessor, stateManager, contextDX)) { if (nextPassID == passID) // Repeat this step, if suggested by the pipe effect binder nextStep = step; if (statePass->Apply(stateManager, contextDX)) drawJob(passID, stateManager, context); } } }
// Gets an effect binder from the given effect. EffectDriver* GenericDefaultEffectDriverCache::GetEffectBinder(const beGraphics::Technique &technique, uint4 flags) { LEAN_PIMPL(); beg::api::EffectTechnique *techniqueDX = ToImpl(technique); M::effect_drivers_t::const_iterator it = m.effectDrivers.find(techniqueDX); if (it == m.effectDrivers.end()) it = m.effectDrivers.insert(std::make_pair( techniqueDX, CreateEffectBinder(technique, flags) )).first; return it->second; }
int SDLNet_CheckSockets(SDLNet_SocketSet set, int timeout_msec) { //fprintf(stderr, "SDLNet_CheckSockets\n"); SocketSet_Impl* impl = ToImpl(set); for (UDPsocket_Impl* socket = impl->udp_sockets_head; socket != NULL; socket = socket->next_) { for (int i = 0; i < 2; ++i) { if (socket->channels[i].packet_head) return 1; } } // If there is no data, then throttle. usleep(timeout_msec * 1000); return 0; }
void SDLNet_UDP_Send(UDPsocket socket, int channel, UDPpacket* packet) { //fprintf(stderr, "SDLNet_UDP_Send (socket=%p, channel=%u, len=%u)\n", socket, channel, packet->len); if (channel < 0) { fprintf(stderr, "channel < 0 not supported!\n"); return; } // Send to the other channel. channel = (channel + 1) % 2; UDPsocket_Impl* impl = ToImpl(socket); UDPpacket** head = &impl->channels[channel].packet_head; UDPpacket** tail = &impl->channels[channel].packet_tail; SListAppend(head, tail, CopyPacket(packet)); }
// Constructor. ProcessingEffectDriver::ProcessingEffectDriver(const beGraphics::Technique &technique, RenderingPipeline *pPipeline, PerspectiveEffectBinderPool *pPool) : m_pipelineBinder( ToImpl(technique), pPipeline, PipelineEffectBinderFlags::AllowUnclassified ), m_perspectiveBinder( ToImpl(technique), pPool ), m_pipeBinder( ToImpl(technique), PipeEffectBinderFlags::NoDefaultMS ) { }