summaryrefslogtreecommitdiff
path: root/libs/rs/rsScriptC_Lib.cpp
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-08-09 15:21:39 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-08-09 15:21:39 -0700
commit8c52cf72f9072a43c03b745ef7562a198dd96e3f (patch)
treeeac1d4b3fa39d093fb96f1fc2c7c5c67f2458da8 /libs/rs/rsScriptC_Lib.cpp
parente4ebbd29f78df25e22c701b597c3c15b7f8add73 (diff)
parent8f5c94b453fdb2873c14c295158caf2334fd5762 (diff)
Merge change 20578
* changes: Better ripples and leaves
Diffstat (limited to 'libs/rs/rsScriptC_Lib.cpp')
-rw-r--r--libs/rs/rsScriptC_Lib.cpp45
1 files changed, 37 insertions, 8 deletions
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index 813af5d54d50..87ddf5868163 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -202,6 +202,11 @@ static float SC_sqrf(float v)
return v * v;
}
+static int SC_sqr(int v)
+{
+ return v * v;
+}
+
static float SC_distf2(float x1, float y1, float x2, float y2)
{
float x = x2 - x1;
@@ -562,22 +567,25 @@ static void SC_drawLine(float x1, float y1, float z1,
glDrawArrays(GL_LINES, 0, 2);
}
-static void SC_drawQuad(float x1, float y1, float z1,
- float x2, float y2, float z2,
- float x3, float y3, float z3,
- float x4, float y4, float z4)
+static void SC_drawQuadTexCoords(float x1, float y1, float z1,
+ float u1, float v1,
+ float x2, float y2, float z2,
+ float u2, float v2,
+ float x3, float y3, float z3,
+ float u3, float v3,
+ float x4, float y4, float z4,
+ float u4, float v4)
{
GET_TLS();
-
+
//LOGE("Quad");
//LOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
//LOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
//LOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
//LOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
-
+
float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
- static const float tex[] = {0,1, 1,1, 1,0, 0,0};
-
+ const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
rsc->setupCheck();
@@ -603,6 +611,17 @@ static void SC_drawQuad(float x1, float y1, float z1,
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
+static void SC_drawQuad(float x1, float y1, float z1,
+ float x2, float y2, float z2,
+ float x3, float y3, float z3,
+ float x4, float y4, float z4)
+{
+ SC_drawQuadTexCoords(x1, y1, z1, 0, 1,
+ x2, y2, z2, 1, 1,
+ x3, y3, z3, 1, 0,
+ x4, y4, z4, 0, 0);
+}
+
static void SC_drawRect(float x1, float y1,
float x2, float y2, float z)
{
@@ -765,6 +784,10 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
"void", "(int)" },
// math
+ { "abs", (void *)&abs,
+ "int", "(int)" },
+ { "absf", (void *)&fabs,
+ "float", "(float)" },
{ "sinf", (void *)&sinf,
"float", "(float)" },
{ "cosf", (void *)&cosf,
@@ -797,8 +820,12 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
"float", "(float, float)" },
{ "minf", (void *)&SC_minf,
"float", "(float, float)" },
+ { "sqrt", (void *)&sqrt,
+ "int", "(int)" },
{ "sqrtf", (void *)&sqrtf,
"float", "(float)" },
+ { "sqr", (void *)&SC_sqr,
+ "int", "(int)" },
{ "sqrf", (void *)&SC_sqrf,
"float", "(float)" },
{ "clampf", (void *)&SC_clampf,
@@ -895,6 +922,8 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
"void", "(float x1, float y1, float x2, float y2, float z)" },
{ "drawQuad", (void *)&SC_drawQuad,
"void", "(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)" },
+ { "drawQuadTexCoords", (void *)&SC_drawQuadTexCoords,
+ "void", "(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, float x4, float y4, float z4, float u4, float v4)" },
{ "drawTriangleArray", (void *)&SC_drawTriangleArray,
"void", "(int ialloc, int count)" },
{ "drawTriangleMesh", (void *)&SC_drawTriangleMesh,