Cleanup includes so Log.h can use the tag. rsUtils.h is the file that should be included everywhere and contain rs global defines.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <utils/misc.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <ui/EGLNativeWindowSurface.h>
|
||||
#include <ui/Surface.h>
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
#include "rsContext.h"
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
@@ -17,11 +17,7 @@
|
||||
#ifndef ANDROID_RS_STRUCTURED_COMPONENT_H
|
||||
#define ANDROID_RS_STRUCTURED_COMPONENT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "RenderScript.h"
|
||||
#include "rsUtils.h"
|
||||
#include "rsObjectBase.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#include "rsThreadIO.h"
|
||||
#include "utils/String8.h"
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
#ifndef ANDROID_RS_CONTEXT_H
|
||||
#define ANDROID_RS_CONTEXT_H
|
||||
|
||||
#include <utils/Vector.h>
|
||||
#include <ui/EGLNativeWindowSurface.h>
|
||||
#include <ui/Surface.h>
|
||||
|
||||
#include "rsType.h"
|
||||
#include "rsMatrix.h"
|
||||
#include "rsAllocation.h"
|
||||
@@ -38,6 +34,10 @@
|
||||
#include "rsgApiStructs.h"
|
||||
#include "rsLocklessFifo.h"
|
||||
|
||||
#include <ui/EGLNativeWindowSurface.h>
|
||||
#include <ui/Surface.h>
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
namespace android {
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
#ifndef ANDROID_RS_DEVICE_H
|
||||
#define ANDROID_RS_DEVICE_H
|
||||
|
||||
#include <utils/Vector.h>
|
||||
|
||||
//#include "StructuredComponent.h"
|
||||
#include "rsUtils.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
namespace android {
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#ifndef ANDROID_STRUCTURED_ELEMENT_H
|
||||
#define ANDROID_STRUCTURED_ELEMENT_H
|
||||
|
||||
#include <utils/Vector.h>
|
||||
|
||||
#include "rsComponent.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
123
libs/rs/rsLight.cpp
Normal file
123
libs/rs/rsLight.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "rsContext.h"
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
Light::Light(bool isLocal, bool isMono)
|
||||
{
|
||||
mIsLocal = isLocal;
|
||||
mIsMono = isMono;
|
||||
|
||||
mX = 0;
|
||||
mY = 0;
|
||||
mZ = 0;
|
||||
|
||||
mR = 1.f;
|
||||
mG = 1.f;
|
||||
mB = 1.f;
|
||||
}
|
||||
|
||||
Light::~Light()
|
||||
{
|
||||
}
|
||||
|
||||
void Light::setPosition(float x, float y, float z)
|
||||
{
|
||||
mX = x;
|
||||
mY = y;
|
||||
mZ = z;
|
||||
}
|
||||
|
||||
void Light::setColor(float r, float g, float b)
|
||||
{
|
||||
mR = r;
|
||||
mG = g;
|
||||
mB = b;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
LightState::LightState()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
LightState::~LightState()
|
||||
{
|
||||
}
|
||||
|
||||
void LightState::clear()
|
||||
{
|
||||
mIsLocal = false;
|
||||
mIsMono = false;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
namespace android {
|
||||
namespace renderscript {
|
||||
|
||||
void rsi_LightBegin(Context *rsc)
|
||||
{
|
||||
rsc->mStateLight.clear();
|
||||
}
|
||||
|
||||
void rsi_LightSetLocal(Context *rsc, bool isLocal)
|
||||
{
|
||||
rsc->mStateLight.mIsLocal = isLocal;
|
||||
}
|
||||
|
||||
void rsi_LightSetMonochromatic(Context *rsc, bool isMono)
|
||||
{
|
||||
rsc->mStateLight.mIsMono = isMono;
|
||||
}
|
||||
|
||||
RsLight rsi_LightCreate(Context *rsc)
|
||||
{
|
||||
Light *l = new Light(rsc->mStateLight.mIsLocal,
|
||||
rsc->mStateLight.mIsMono);
|
||||
l->incRef();
|
||||
return l;
|
||||
}
|
||||
|
||||
void rsi_LightDestroy(Context *rsc, RsLight vl)
|
||||
{
|
||||
Light *l = static_cast<Light *>(vl);
|
||||
l->decRef();
|
||||
}
|
||||
|
||||
void rsi_LightSetColor(Context *rsc, RsLight vl, float r, float g, float b)
|
||||
{
|
||||
Light *l = static_cast<Light *>(vl);
|
||||
l->setColor(r, g, b);
|
||||
}
|
||||
|
||||
void rsi_LightSetPosition(Context *rsc, RsLight vl, float x, float y, float z)
|
||||
{
|
||||
Light *l = static_cast<Light *>(vl);
|
||||
l->setPosition(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
62
libs/rs/rsLight.h
Normal file
62
libs/rs/rsLight.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_LIGHT_H
|
||||
#define ANDROID_LIGHT_H
|
||||
|
||||
|
||||
#include "rsObjectBase.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
namespace android {
|
||||
namespace renderscript {
|
||||
|
||||
|
||||
// An element is a group of Components that occupies one cell in a structure.
|
||||
class Light : public ObjectBase
|
||||
{
|
||||
public:
|
||||
Light(bool isLocal, bool isMono);
|
||||
virtual ~Light();
|
||||
|
||||
// Values, mutable after creation.
|
||||
void setPosition(float x, float y, float z);
|
||||
void setColor(float r, float g, float b);
|
||||
|
||||
protected:
|
||||
float mR, mG, mB;
|
||||
float mX, mY, mZ;
|
||||
bool mIsLocal;
|
||||
bool mIsMono;
|
||||
};
|
||||
|
||||
|
||||
class LightState {
|
||||
public:
|
||||
LightState();
|
||||
~LightState();
|
||||
|
||||
void clear();
|
||||
|
||||
bool mIsMono;
|
||||
bool mIsLocal;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif //ANDROID_LIGHT_H
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
using namespace android;
|
||||
|
||||
#include <utils/Log.h>
|
||||
|
||||
LocklessCommandFifo::LocklessCommandFifo()
|
||||
{
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
#define ANDROID_RS_LOCKLESS_FIFO_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include "rsUtils.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include "string.h"
|
||||
#include "math.h"
|
||||
|
||||
#include <utils/Log.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
#include "rsObjectBase.h"
|
||||
#include <utils/Log.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
#include "rsContext.h"
|
||||
#include "rsProgramFragment.h"
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
#include "rsContext.h"
|
||||
#include "rsProgramFragmentStore.h"
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
#include "rsContext.h"
|
||||
#include "rsProgramVertex.h"
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
@@ -14,16 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "rsContext.h"
|
||||
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "rsContext.h"
|
||||
#include "rsSampler.h"
|
||||
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
@@ -17,11 +17,6 @@
|
||||
#ifndef ANDROID_RS_SAMPLER_H
|
||||
#define ANDROID_RS_SAMPLER_H
|
||||
|
||||
#include <math.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#include "rsAllocation.h"
|
||||
#include "RenderScript.h"
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#include "acc/acc.h"
|
||||
#include "utils/String8.h"
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
#include "rsContext.h"
|
||||
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "rsThreadIO.h"
|
||||
|
||||
using namespace android;
|
||||
|
||||
@@ -17,11 +17,7 @@
|
||||
#ifndef ANDROID_RS_THREAD_IO_H
|
||||
#define ANDROID_RS_THREAD_IO_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "RenderScript.h"
|
||||
|
||||
#include "rsUtils.h"
|
||||
#include "rsLocklessFifo.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -22,8 +22,6 @@ using namespace android::renderscript;
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#include <utils/Log.h>
|
||||
|
||||
TriangleMesh::TriangleMesh()
|
||||
{
|
||||
mVertexElement = NULL;
|
||||
|
||||
@@ -17,15 +17,6 @@
|
||||
#ifndef ANDROID_RS_TRIANGLE_MESH_H
|
||||
#define ANDROID_RS_TRIANGLE_MESH_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#include <utils/Vector.h>
|
||||
|
||||
#include "RenderScript.h"
|
||||
|
||||
@@ -60,7 +51,7 @@ public:
|
||||
size_t mSizeNorm;
|
||||
|
||||
// GL buffer info
|
||||
GLuint mBufferObjects[2];
|
||||
uint32_t mBufferObjects[2];
|
||||
|
||||
void analyzeElement();
|
||||
protected:
|
||||
|
||||
@@ -17,9 +17,13 @@
|
||||
#ifndef ANDROID_RS_UTILS_H
|
||||
#define ANDROID_RS_UTILS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include "RenderScript.h"
|
||||
|
||||
#define LOG_TAG "rs"
|
||||
#include <utils/Log.h>
|
||||
#include <utils/Vector.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
|
||||
namespace android {
|
||||
namespace renderscript {
|
||||
|
||||
Reference in New Issue
Block a user