New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localisation Issues with Floats #5

Open
dwmkerr opened this Issue Mar 20, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@dwmkerr
Owner

dwmkerr commented Mar 20, 2014

Original issue:

https://sharpgl.codeplex.com/workitem/1114

I couldn't load ducky.obj from samples because serializator couldn't convert string to float (in obj file coordinates 1.0 in float type 1,0). I fixed it with this:

  for (int i = 0; i < values.Length; i++ )
                        {
                            string fixstring=values[i].Replace(".",",");
                            values[i] = fixstring;
                        }

Same problem with materials.
UV . In OpenGL UV coordinates differs from directX. V=1-V
Here is fix :

  if (line.StartsWith("vt"))
                    {
                        //  Get the texture coord strings.
                        string[] values = line.Substring(3).Split(split, StringSplitOptions.RemoveEmptyEntries);

                        for (int i = 0; i < values.Length; i++ )
                        {
                            string fixstring=values[i].Replace(".",",");
                            values[i] = fixstring;
                        }
                        //  Parse texture coordinates.
                        float u = float.Parse(values[0]);
                        float v = float.Parse(values[1]);

                        //  Add the texture coordinate.
                        polygon.UVs.Add(new UV(u, 1-v));

                        continue;
                    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment