X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbox.cpp;h=46f1b48ed7bfc315a23a221134544adcccf5c19e;hp=3d6f15fdc6f422e3259088de7a599b8eba6ba762;hb=ef9ffbc287417520d223ce29dc6c2de110cac945;hpb=bbfb79181f716736df413f463b55825866400ed8 diff --git a/source/box.cpp b/source/box.cpp index 3d6f15fd..46f1b48e 100644 --- a/source/box.cpp +++ b/source/box.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2011 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include "box.h" #include "primitivebuilder.h" @@ -42,31 +35,32 @@ void BoxBuilder::build(PrimitiveBuilder &builder) const void BoxBuilder::build_face(PrimitiveBuilder &builder, const Vector3 &o, const Vector3 &s1, const Vector3 &s2) const { - if(tangent_attr>=0) + float l1 = 1, l2 = 1; + if(generate_tbn || tex_fit!=STRETCH) { - builder.attrib(tangent_attr, s1.x, s1.y, s1.z); - builder.attrib(binormal_attr, s2.x, s2.y, s2.z); + l1 = s1.norm(); + l2 = s2.norm(); } - float u_size = 1; - float v_size = 1; - if(tex_fit!=STRETCH) + + if(generate_tbn) { - float l1 = sqrt(s1.x*s1.x+s1.y*s1.y+s1.z*s1.z); - float l2 = sqrt(s2.x*s2.x+s2.y*s2.y+s2.z*s2.z); - if((l1