Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

4 Neutral

About cowcow

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I wrote a multithreaded, nonblocking TCP server: https://github.com/sjhalayka/tcpspeed3_multithreaded_listener
  2. cowcow

    Marching Cubes and Dual Contouring Tutorial

    I even performed Taubin smoothing on the mini-meshes. It didn't work out. I have code for it.
  3. I posted some code on GitHub, thanks to you guys: https://github.com/sjhalayka/python_cpp_interface_mat_char_array
  4. Thanks for the help!
  5. I'm trying to get void** pointers working with Python's ctypes. Has anyone ever had this kind of experience? I'm trying to print out the value 123.456f; in the Python code. My code is: #define DLLEXPORT extern "C" __declspec(dllexport) DLLEXPORT int func(void **ptr) { float *p = new float; p[0] = 123.456f; ptr = reinterpret_cast<void**>(&p); return 0; } and import ctypes as ct """ DLLEXPORT int func(void **ptr) """ lib = ct.CDLL("void_dll.dll") x = ct.pointer(ct.c_vo) lib.func(ct.byref(x)) print(x)
  6. cowcow

    FreeGLUT - Making Planets Orbit

    Maybe share your code on GitHub to see what went wrong. I think the idea of rotation is good, but it would only handle orbits that are circular (no eccentricity).
  7. cowcow

    FreeGLUT - Making Planets Orbit

    Just in case it's not clear... The gravitation constant G is 6.673e-11. The sun's mass M is 1.989e30. For the planet Mercury: The aphelion distance is 69817079000. The perihelion distance is 46001200000. The semi major axis A is the (perihelion distance + the aphelion distance) / 2 is 57909100000. The eccentricity e is 0.20563069. The orbit speed at aphelion is v = sqrt((G*M/A) * (1 - e)/(1 + e)) = 38860.5.
  8. cowcow

    FreeGLUT - Making Planets Orbit

    Yes, every time the idle function is called, one will do these things to calculate the position and velocity: https://gist.github.com/sjhalayka/a499a7f0429884bf3fd6ef38151ecd58 There is also this Mercury fact sheet, from which you can obtain the speed of mercury at perihelion (closest approach) and aphelion (furthest approach): https://nssdc.gsfc.nasa.gov/planetary/factsheet/mercuryfact.html That is, the speed (the length of the velocity vector) of Mercury at aphelion is 38860 metres per second, like in the code I posted. I'm not super experienced with scene graphs, sorry. In my code I don't use a scene graph -- I just alter the planet object's position and velocity, and then pass the position directly into glVertex3f(). That's right, I use OpenGL 1.x for the demo. All I know is that scene graphs become very important when it comes to solving for inverse kinematics? There's a hierarchy going on there? I checked out Mario Kart for Switch, and they got some serious physics + inverse kinematics to model the idle animations of the contestants. LOL
  9. cowcow

    FreeGLUT - Making Planets Orbit

    I also put up a C++/OpenGL 1.x/GLUT application that draws Mercury's path as it orbits the Sun. To start the simulation, the planet is placed at the aphelion (0, 69817079000, 0), with an initial velocity (-38860, 0, 0), and everything is taken care of from there. https://github.com/sjhalayka/mercury_orbit_glut Check out idle_func() in main.cpp. That's where the integration occurs.
  10. cowcow

    FreeGLUT - Making Planets Orbit

    You alter the position and velocity of each planet by integrating (adding). Your position is updated by the velocity, and the velocity is updated by the acceleration. Here is some math related to calculating a position and velocity for the orbiting body:
  11. cowcow

    Marching Cubes and Dual Contouring Tutorial

    I put up the C++ code for a DLL for Windows on GitHub. The DLL exports a function that takes in all of the quaternion Julia set parameters, as well as parameters related to the 3D grid extent, resolution, etc. I also included a .py file to show how to call the function from the DLL using Python (the function returns the surface normal gotten by the Marching Cubes algorithm). https://github.com/sjhalayka/marching_cubes_dll The relevant C++ file is mc_dll.cpp and the relevant Python file is mc_dll.py It still suffers from a jittery surface. Can't say that I didn't try.
  12. Hell yes, that's exactly what I wanted to do! Thanks again.
  13. I got it all working. Thank you for the information. I am now able to call from Python a function that I wrote which generates the surface normal of a quaternion Julia set using Marching Cubes. My final code is... #define DLLEXPORT extern "C" __declspec(dllexport) DLLEXPORT void get_normal(float x_grid_min, float x_grid_max, float y_grid_min, float y_grid_max, float z_grid_min, float z_grid_max, unsigned int x_res, unsigned int y_res, unsigned int z_res, float *output) { // ... stuff } and... def get_normal_from_mc(src_x_grid_min, src_x_grid_max, src_y_grid_min, src_y_grid_max, src_z_grid_min, src_z_grid_max, src_x_res, src_y_res, src_z_res): float3 = ct.c_float * 3 int1 = ct.c_uint float1 = ct.c_float x_grid_min = float1(src_x_grid_min) x_grid_max = float1(src_x_grid_max) y_grid_min = float1(src_y_grid_min) y_grid_max = float1(src_y_grid_max) z_grid_min = float1(src_z_grid_min) z_grid_max = float1(src_z_grid_max) x_res = int1(src_x_res) y_res = int1(src_y_res) z_res = int1(src_z_res) output_arr = float3() lib = ct.CDLL("mc_dll.dll") lib.get_normal(x_grid_min, x_grid_max, y_grid_min, y_grid_max, z_grid_min, z_grid_max, x_res, y_res, z_res, output_arr) ret = V3(output_arr[0], output_arr[1], output_arr[2]) return ret
  14. OK thank you very much; that seemed to have helped. How would I set up for and call the function from Python: DLLEXPORT int print_normal_to_file(float x_grid_min, float x_grid_max, float y_grid_min, float y_grid_max, float z_grid_min, float z_grid_max, size_t x_res, size_t y_res, size_t z_res, char *filename)
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!