summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsScriptC_Lib.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-08-07 15:40:32 -0700
committerRomain Guy <romainguy@android.com>2009-08-07 15:40:32 -0700
commit6c0cc6db9966bda47d04ecdd1a4692b11cf3775a (patch)
tree8d7513e2ea2b13550f5507ac794adbbbb11f9e75 /libs/rs/rsScriptC_Lib.cpp
parent4c35e2c59afa28f9ed3fab1788570ef933f29b1a (diff)
downloadframeworks_base-6c0cc6db9966bda47d04ecdd1a4692b11cf3775a.zip
frameworks_base-6c0cc6db9966bda47d04ecdd1a4692b11cf3775a.tar.gz
frameworks_base-6c0cc6db9966bda47d04ecdd1a4692b11cf3775a.tar.bz2
Add refraction and bettr normals computation to FallRS
Diffstat (limited to 'libs/rs/rsScriptC_Lib.cpp')
-rw-r--r--libs/rs/rsScriptC_Lib.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index b17121f..813af5d 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -544,6 +544,24 @@ static void SC_drawTriangleArray(int ialloc, uint32_t count)
glDrawArrays(GL_TRIANGLES, 0, count * 3);
}
+static void SC_drawLine(float x1, float y1, float z1,
+ float x2, float y2, float z2)
+{
+ GET_TLS();
+ rsc->setupCheck();
+
+ float vtx[] = { x1, y1, z1, x2, y2, z2 };
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, vtx);
+
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+
+ 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,
@@ -627,10 +645,9 @@ static void SC_emission(float r, float g, float b, float a)
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, params);
}
-static void SC_shininess(float r, float g, float b, float a)
+static void SC_shininess(float s)
{
- GLfloat params[] = { r, g, b, a };
- glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, params);
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, s);
}
static void SC_hsb(float h, float s, float b, float a)
@@ -686,25 +703,6 @@ static void SC_hsb(float h, float s, float b, float a)
glColor4f(red, green, blue, a);
}
-/*
-extern "C" void materialDiffuse(float r, float g, float b, float a)
-{
- float v[] = {r, g, b, a};
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, v);
-}
-
-extern "C" void materialSpecular(float r, float g, float b, float a)
-{
- float v[] = {r, g, b, a};
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, v);
-}
-
-extern "C" void materialShininess(float s)
-{
- glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, &s);
-}
-*/
-
static void SC_uploadToTexture(RsAllocation va, uint32_t baseMipLevel)
{
GET_TLS();
@@ -903,6 +901,8 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
"void", "(int mesh)" },
{ "drawTriangleMeshRange", (void *)&SC_drawTriangleMeshRange,
"void", "(int mesh, int start, int count)" },
+ { "drawLine", (void *)&SC_drawLine,
+ "void", "(float x1, float y1, float z1, float x2, float y2, float z2)" },
// misc
@@ -921,7 +921,7 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
{ "emission", (void *)&SC_emission,
"void", "(float, float, float, float)" },
{ "shininess", (void *)&SC_shininess,
- "void", "(float, float, float, float)" },
+ "void", "(float)" },
{ "uploadToTexture", (void *)&SC_uploadToTexture,
"void", "(int, int)" },