|
@@ -926,6 +926,16 @@ void tnsApplyRotation43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v){
|
|
result[1] = mat[4] * v[0] + mat[5] * v[1] + mat[6] * v[2];
|
|
result[1] = mat[4] * v[0] + mat[5] * v[1] + mat[6] * v[2];
|
|
result[2] = mat[8] * v[0] + mat[9] * v[1] + mat[10] * v[2];
|
|
result[2] = mat[8] * v[0] + mat[9] * v[1] + mat[10] * v[2];
|
|
}
|
|
}
|
|
|
|
+//void tnsApplyRotation33d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v){
|
|
|
|
+// result[0] = mat[0] * v[0] + mat[3] * v[1] + mat[6] * v[2];
|
|
|
|
+// result[1] = mat[1] * v[0] + mat[4] * v[1] + mat[7] * v[2];
|
|
|
|
+// result[2] = mat[2] * v[0] + mat[5] * v[1] + mat[8] * v[2];
|
|
|
|
+//}
|
|
|
|
+//void tnsApplyRotation43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v){
|
|
|
|
+// result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2];
|
|
|
|
+// result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2];
|
|
|
|
+// result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2];
|
|
|
|
+//}
|
|
void tnsApplyTransform43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v){
|
|
void tnsApplyTransform43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v){
|
|
real w;
|
|
real w;
|
|
result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
|
|
result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
|
|
@@ -1965,7 +1975,7 @@ void tnsActiveTexture(GLenum tex){
|
|
T->GlTextureSets = tex;
|
|
T->GlTextureSets = tex;
|
|
}
|
|
}
|
|
void tnsBindTexture(tnsTexture *t){
|
|
void tnsBindTexture(tnsTexture *t){
|
|
- if ((!t) || T->TexColor==t) return;
|
|
|
|
|
|
+ if (!t) return;
|
|
if(t->IsUIntTexture){ tnsActiveTexture(GL_TEXTURE2); glBindTexture(t->GLTexType, t->GLTexHandle); T->TexColor=t; return; }
|
|
if(t->IsUIntTexture){ tnsActiveTexture(GL_TEXTURE2); glBindTexture(t->GLTexType, t->GLTexHandle); T->TexColor=t; return; }
|
|
if(t->GLTexType == GL_TEXTURE_2D){ tnsActiveTexture(GL_TEXTURE0); glBindTexture(t->GLTexType, t->GLTexHandle); T->TexColor=t;}
|
|
if(t->GLTexType == GL_TEXTURE_2D){ tnsActiveTexture(GL_TEXTURE0); glBindTexture(t->GLTexType, t->GLTexHandle); T->TexColor=t;}
|
|
#ifndef LAGUI_ANDROID
|
|
#ifndef LAGUI_ANDROID
|
|
@@ -1989,6 +1999,9 @@ void tnsUnbindTexture(){
|
|
else if(T->TexColor->GLTexType == GL_TEXTURE_3D){tnsActiveTexture(GL_TEXTURE0);}
|
|
else if(T->TexColor->GLTexType == GL_TEXTURE_3D){tnsActiveTexture(GL_TEXTURE0);}
|
|
glBindTexture(T->TexColor->GLTexType, 0); T->TexColor=0;
|
|
glBindTexture(T->TexColor->GLTexType, 0); T->TexColor=0;
|
|
}
|
|
}
|
|
|
|
+ if(T->TexColor2){
|
|
|
|
+ tnsActiveTexture(GL_TEXTURE4); glBindTexture(T->TexColor2->GLTexType, 0); T->TexColor2=0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
void tnsBindTexture2(tnsTexture *t){
|
|
void tnsBindTexture2(tnsTexture *t){
|
|
if ((!t) || T->TexColor2==t) return;
|
|
if ((!t) || T->TexColor2==t) return;
|
|
@@ -1996,7 +2009,7 @@ void tnsBindTexture2(tnsTexture *t){
|
|
}
|
|
}
|
|
void tnsUnbindTexture2(){
|
|
void tnsUnbindTexture2(){
|
|
if(T->TexColor2){
|
|
if(T->TexColor2){
|
|
- tnsActiveTexture(GL_TEXTURE4); glBindTexture(T->TexColor->GLTexType, 0); T->TexColor=0;
|
|
|
|
|
|
+ tnsActiveTexture(GL_TEXTURE4); glBindTexture(T->TexColor2->GLTexType, 0); T->TexColor2=0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
void tnsUniformUseTexture(tnsShader* s, int mode, int sample, int TexIsUInt, int Tex2IsUInt){
|
|
void tnsUniformUseTexture(tnsShader* s, int mode, int sample, int TexIsUInt, int Tex2IsUInt){
|
|
@@ -4679,27 +4692,27 @@ void tnsPrintMaterials(){
|
|
extern LA MAIN;
|
|
extern LA MAIN;
|
|
|
|
|
|
void tnssRGB2XYZ(tnsVector3d rgb,tnsVector3d xyz){
|
|
void tnssRGB2XYZ(tnsVector3d rgb,tnsVector3d xyz){
|
|
- tnsMatrix44d mat={0.4124564,0.3575761,0.1804375,0,
|
|
|
|
- 0.2126729,0.7151522,0.0721750,0,
|
|
|
|
- 0.0193339,0.1191920,0.9503041,0,0,0,0,0};
|
|
|
|
|
|
+ tnsMatrix44d mat={0.4124564,0.3575761,0.1804375,
|
|
|
|
+ 0.2126729,0.7151522,0.0721750,
|
|
|
|
+ 0.0193339,0.1191920,0.9503041};
|
|
tnsApplyRotation33d(xyz,mat,rgb);
|
|
tnsApplyRotation33d(xyz,mat,rgb);
|
|
}
|
|
}
|
|
void tnsClay2XYZ(tnsVector3d rgb,tnsVector3d xyz){
|
|
void tnsClay2XYZ(tnsVector3d rgb,tnsVector3d xyz){
|
|
- tnsMatrix44d mat={0.5767309,0.1855540,0.1881852,0,
|
|
|
|
- 0.2973769,0.6273491,0.0752741,0,
|
|
|
|
- 0.0270343,0.0706872,0.9911085,0,0,0,0,0};
|
|
|
|
|
|
+ tnsMatrix44d mat={0.5767309,0.1855540,0.1881852,
|
|
|
|
+ 0.2973769,0.6273491,0.0752741,
|
|
|
|
+ 0.0270343,0.0706872,0.9911085};
|
|
tnsApplyRotation33d(xyz,mat,rgb);
|
|
tnsApplyRotation33d(xyz,mat,rgb);
|
|
}
|
|
}
|
|
void tnsXYZ2sRGB(tnsVector3d xyz,tnsVector3d rgb){
|
|
void tnsXYZ2sRGB(tnsVector3d xyz,tnsVector3d rgb){
|
|
- tnsMatrix44d mat={3.2404542,-1.5371385,-0.4985314,0,
|
|
|
|
- -0.9692660,1.8760108,0.0415560,0,
|
|
|
|
- 0.0556434,-0.2040259,1.0572252,0,0,0,0,0};
|
|
|
|
|
|
+ tnsMatrix44d mat={3.2404542,-1.5371385,-0.4985314,
|
|
|
|
+ -0.9692660,1.8760108,0.0415560,
|
|
|
|
+ 0.0556434,-0.2040259,1.0572252};
|
|
tnsApplyRotation33d(rgb,mat,xyz);
|
|
tnsApplyRotation33d(rgb,mat,xyz);
|
|
}
|
|
}
|
|
void tnsXYZ2Clay(tnsVector3d xyz,tnsVector3d rgb){
|
|
void tnsXYZ2Clay(tnsVector3d xyz,tnsVector3d rgb){
|
|
- tnsMatrix44d mat={2.0413690,-0.5649464,-0.3446944,0,
|
|
|
|
- -0.9692660,1.8760108,0.0415560,0,
|
|
|
|
- 0.0134474,-0.1183897,1.0154096,0,0,0,0,0};
|
|
|
|
|
|
+ tnsMatrix44d mat={2.0413690,-0.5649464,-0.3446944,
|
|
|
|
+ -0.9692660,1.8760108,0.0415560,
|
|
|
|
+ 0.0134474,-0.1183897,1.0154096};
|
|
tnsApplyRotation33d(rgb,mat,xyz);
|
|
tnsApplyRotation33d(rgb,mat,xyz);
|
|
}
|
|
}
|
|
void tnsRGB2Clay(tnsVector3d rgb, tnsVector3d clay){
|
|
void tnsRGB2Clay(tnsVector3d rgb, tnsVector3d clay){
|