Skip to content

Conversation

@DigitalBox98
Copy link

This version is inspired by adamsmith1990 initial work but with the same approach than LearnOpenGL website for textures rendering.

Camera movement is via the left-click on mouse and wireframe/plain texture via the N key.

Tested OK on dotnet6.0 (and revert to dotnet8.0 before commit)

plain wire

Version with same approach than LearnOpenGL for textures
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should mark the OBJ file as a binary file or something like that so that git doesn't track 200k lines in this commit. Can you mark a file as binary and still have automatic EOL conversions happen?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, via .gitattributes

Copy link
Member

@NogginBops NogginBops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some things I want to change with this in the future but I think it's fine to get this merged as it is right now and then I can use my review comments as TODOs in #89.

Common/Model.cs Outdated
{
TextureSlot str;
mat.GetMaterialTexture(type, i, out str);
string filename = directory + "/" + str.FilePath;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be Path.Combine(directory, str.FilePath).

public string path;

public static Texture LoadFromFile(string path)
public static Texture LoadFromFile(string filename, string type = "texture_diffuse")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally avoid default arguments in opentk code. Also I don't think this field is a good idea, and if we where going to do it I would rather this be an enum rather than a string.

Comment on lines +65 to +74
string number = new string("0");
string name = textures[i].type;
if (name == "texture_diffuse")
number = new string(""+diffuseNr++);
else if (name == "texture_specular")
number = new string("" + specularNr++); // transfer int to string
else if (name == "texture_normal")
number = new string("" + normalNr++); // transfer int to string
else if (name == "texture_height")
number = new string("" + heightNr++); // transfer int to string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to rework this texture solution in it's entirety.
But I think it's fine for this PR, I'll be able to do the rework as part of #89.

@NogginBops
Copy link
Member

I just realized that there are two model loading PRs.
Will take a look at #76 and see if we can reconcile these PRs and get a best of both worlds.

@NogginBops
Copy link
Member

Also, after marking .obj files as binary you also have to "re-add" the file to get git to actually consider it a binary file. The diff of this PR is still 200 thousand lines.

@DigitalBox98
Copy link
Author

Ok i have removed the backpack.obj and then added it again.
I'm not sure if it has worked as I can see this file in this PR not considered as a BIN.
Is there anything wrong somewhere ?

@deccer
Copy link
Contributor

deccer commented Feb 24, 2024

bin and obj and all their combinations are in .gitignore, because of bin and obj folders. I am not sure if we should include rather large model files in this repo

@MauNguyenVan
Copy link

I don't think we should add large files to this repository.
In my opinion, we should store them on the OpenTK website server instead.
We can then add comments in the code (or documentation) to let users know:

  • which files they need to download,
  • where to download them from
  • where to place the files in their local setup.

@utkumaden
Copy link

Looks like this PR got resurrected but here's my two cents on the matter. I'm personally against storing large files outside of the repository because:

  • links rot over time
  • downloading a repository should give you everything needed to compile and run offline, ideally.
  • the webpage is already hosted in github pages, it just moves it from one git repo to another.

Storing large objects in git is fine as long as they don't change a lot. Which, in this case, is not what I think will happen.

As for the .gitignore, we can either modify the gitignore rule to keep with !**.obj or force add, both of which are fine imo.

@NogginBops
Copy link
Member

The obj file with textures should be part of the repo. They are not that big and with them properly marked as binaries and the fact that they are not going to be updated frequently makes their size not really a problem.

@DigitalBox98
Copy link
Author

I confirm the obj file is not supposed to be updated once published

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants