refactoring mesh into cplusplus struct