Skip to content
This repository was archived by the owner on Apr 24, 2020. It is now read-only.

Automatic Header Guard Generation #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions obj2opengl.pl
Original file line number Diff line number Diff line change
@@ -429,6 +429,8 @@ sub writeOutput {
open ( OUTFILE, ">$outFilename" )
|| die "Can't create file $outFilename ... exiting\n";

my $outTag = substr($outFilename, 2, length($outFilename) - 4);

print OUTFILE "/*\n";
print OUTFILE "created with obj2opengl.pl\n\n";

@@ -455,6 +457,9 @@ sub writeOutput {
print OUTFILE "glDrawArrays(GL_TRIANGLES, 0, ".$object."NumVerts);\n";
print OUTFILE "*/\n\n";

print OUTFILE "#ifndef $outTag" . "_h\n";
print OUTFILE "#define $outTag" . "_h\n\n";

# needed constant for glDrawArrays
print OUTFILE "unsigned int ".$object."NumVerts = ".($numFaces * 3).";\n\n";

@@ -503,6 +508,7 @@ sub writeOutput {

print OUTFILE "};\n\n";
}
print OUTFILE "#endif /* !$outTag" . "_h */";

close OUTFILE;
}