Tools and TCP Networking
On and off for the past several weeks I’ve begun implementing different functionality to allow me to stream changes over the network from an editor window to the viewer window. Ideally, when I complete this I’ll be able to add, remove, and modify vertices in models in the editor and stream the changes to the viewer.
The goal of the project was to begin developing a networked toolset that streamed changes from different editors to the main scene view. I used my bezier curve implementation for the initial demonstration to generate a curve and then stream control point changes to the viewer window over TCP. In this demo, I needed to guarantee that data would arrive reliably and in order. If I needed more configuration options for different data, then I’d probably write a layer over UDP to handle different levels of reliability.
I implemented the connection layer using Winsock and Berkley sockets for cross platform development. The basic process of setting up the sockets is:
Server: startup > create > bind > listen > close > shutdown
Client: startup > create > connect > close > shutdown
For the demo, I set the sockets to nob-blocking, allowing me to receive data without stalling the application. If I extend the project further, I’ll probably use a blocking socket with a separate thread for streaming changes.
I’m currently in the process of getting an implementation of ray picking in place for mouse clicking in 3D space. The the following procedure:
screen space > normalized screen space (-1 to 1) > object space
Applying the inverse view projection matrix to the normalized screen point should produce the correct point in 3D space, but I haven’t received the expected results. I plan continue working on this, and updating this with more details upon completion.
March 17, 2013