Gallery3D中画图时调用glTranslate函数参数赋值过程
2010-09-20 13:51
549 查看
简介:这是Gallery3D中画图时调用glTranslate函数参数赋值过程的详细页面,介绍了和手机软件,Android Gallery3D中画图时调用glTranslate函数参数赋值过程有关的知识,加入收藏请按键盘ctrl+D,谢谢大家的观看!要查看更多有关信息,请点击此处
GridDrawManager::drawDisplayItem(RenderView view, GL11 gl, DisplayItem displayItem, Texture texture, int pass,Texture previousTexture, float mixRatio) 函数有下面几句:
调用过程:
->computeVisibleItems(),displayItems[baseIndex + j] = displayItem;Vector3f position = pool.create(); GridCameraManager.getSlotPositionForSlotIndex(i, camera, layout, deltaAnchorPosition, position);//give position value displayList.setPositionAndStackIndex(displayItem, position, j, true);//raletive position to item
->GridLayer, mDrawManager = new GridDrawManager(context, mCamera, mDrawables, sDisplayList, sDisplayItems, sDisplaySlots);
->GridDrawManager(), mDisplayItems = displayItems;
->drawFocusItems ,DisplayItem[] displayItems = mDisplayItems;
->animatedPosition = displayItem.mAnimatedPosition;
->drawDisplayItem, amAnimatedPosition
->DisplayItem::commit() amAnimatedPosition.set(mTargetPosition);
-> DisplayItem::set(Vector3f position, int stackIndex, boolean performTransition) mTargetPosition.z =
在gallery3d中矩阵是从上到下、从左到右排列的,在主界面时最多有3行,mNumRows=3,在缩略图界面最多4行mNumRows=4,在查看界面只有一行mNumRows=1
上面函数是计算所绘制项位置的,slotIndex / mNumRows得到的是当前处于多少列,slotIndex % mNumRows得到的是处于多少行。 int maxY = (mNumRows - 1) * (itemHeight + mSpacingY);
outPosition.y -= (maxY >> 1);是为了在y方向对称,想成屏幕中间是分界线,以上的项y为负,线以下的y为正。
deltaAnchorPosition的赋值过程:
MediaFeed::run()
onFeedChanged(, onLayout(newSlotIndex, currentlyVisibleSlotIndex, null);
onLayout, sDeltaAnchorPositionUncommited.set(deltaAnchorPosition);
computeVisibleRange(),sDeltaAnchorPosition.set(sDeltaAnchorPositionUncommited);
deltaAnchorPosition.set(sDeltaAnchorPosition);
deltaAnchorPosition
GridDrawManager::drawDisplayItem(RenderView view, GL11 gl, DisplayItem displayItem, Texture texture, int pass,Texture previousTexture, float mixRatio) 函数有下面几句:
Vector3f animatedPosition = displayItem.mAnimatedPosition; float translateXf = animatedPosition.x * camera.mOneByScale; float translateYf = animatedPosition.y * camera.mOneByScale; float translateZf = -animatedPosition.z;
调用过程:
->computeVisibleItems(),displayItems[baseIndex + j] = displayItem;Vector3f position = pool.create(); GridCameraManager.getSlotPositionForSlotIndex(i, camera, layout, deltaAnchorPosition, position);//give position value displayList.setPositionAndStackIndex(displayItem, position, j, true);//raletive position to item
->GridLayer, mDrawManager = new GridDrawManager(context, mCamera, mDrawables, sDisplayList, sDisplayItems, sDisplaySlots);
->GridDrawManager(), mDisplayItems = displayItems;
->drawFocusItems ,DisplayItem[] displayItems = mDisplayItems;
->animatedPosition = displayItem.mAnimatedPosition;
->drawDisplayItem, amAnimatedPosition
->DisplayItem::commit() amAnimatedPosition.set(mTargetPosition);
-> DisplayItem::set(Vector3f position, int stackIndex, boolean performTransition) mTargetPosition.z =
public void getPositionForSlotIndex(int slotIndex, int itemWidth, int itemHeight, Vector3f outPosition) { outPosition.x = (slotIndex / mNumRows) * (itemWidth + mSpacingX); outPosition.y = (slotIndex % mNumRows) * (itemHeight + mSpacingY); int maxY = (mNumRows - 1) * (itemHeight + mSpacingY); outPosition.y -= (maxY >> 1); outPosition.z = 0; Log.d("outPosition","slotIndex="+slotIndex+",mNumRows="+mNumRows+",outPosition=("+outPosition.x+","+outPosition.y+","+outPosition.z+")"); }
在gallery3d中矩阵是从上到下、从左到右排列的,在主界面时最多有3行,mNumRows=3,在缩略图界面最多4行mNumRows=4,在查看界面只有一行mNumRows=1
上面函数是计算所绘制项位置的,slotIndex / mNumRows得到的是当前处于多少列,slotIndex % mNumRows得到的是处于多少行。 int maxY = (mNumRows - 1) * (itemHeight + mSpacingY);
outPosition.y -= (maxY >> 1);是为了在y方向对称,想成屏幕中间是分界线,以上的项y为负,线以下的y为正。
deltaAnchorPosition的赋值过程:
int currentlyVisibleSlotIndex = getAnchorSlotIndex(ANCHOR_CENTER);->anchorItem = displayItem.mItemRef;-> newSlotIndex = i;->if (currentAnchorSlotIndex != Shared.INVALID && newAnchorSlotIndex != Shared.INVALID) { layout.getPositionForSlotIndex(newAnchorSlotIndex, itemWidth, itemHeight, deltaAnchorPosition); oldLayout.getPositionForSlotIndex(currentAnchorSlotIndex, itemWidth, itemHeight, currentSlotPosition); currentSlotPosition.subtract(sDeltaAnchorPosition); deltaAnchorPosition.subtract(currentSlotPosition); deltaAnchorPosition.y = 0; deltaAnchorPosition.z = 0; }
MediaFeed::run()
onFeedChanged(, onLayout(newSlotIndex, currentlyVisibleSlotIndex, null);
onLayout, sDeltaAnchorPositionUncommited.set(deltaAnchorPosition);
computeVisibleRange(),sDeltaAnchorPosition.set(sDeltaAnchorPositionUncommited);
deltaAnchorPosition.set(sDeltaAnchorPosition);
deltaAnchorPosition
相关文章推荐
- 函数调用过程及参数传递
- MySQL存储过程和自定义函数、Navicat、创建存储过程和函数、调用存储过程和函数、三种方式、In和Out类型参数、
- 函数调用过程中,函数参数的入栈顺序
- 函数调用过程中,函数参数的入栈顺序,why?
- C++中函数调用中构造函数、析构函数、赋值过程
- ARM系统中函数调用过程中的参数传递
- 数据库技术_Orcale技术(0002)_5分钟会用存储过程_存储过程简单实例(包含循环、条件、增改查、参数传入、变量赋值、java调用等)
- 函数调用过程中所有参数的提取
- 调用参数为pchar类型的函数或过程时注意点
- ARM系统中函数调用过程中的参数传递-转
- 'VB编程 编写一个竞赛评分的函数过程。评委打分为参数(数组参数),选手得分为函数值。记分规则为:去掉一个最高分,去掉一个最低分,然后求平均。调用该函数,由键盘输入5个评委的打分(存放在数组中),输出
- MySQL存储过程和自定义函数、Navicat、创建存储过程和函数、调用存储过程和函数、三种方式、In和Out类型参数、
- python 函数参数赋值过程
- 是否可以通过绝对内存地址进行参数赋值与函数调用---转载
- C++关于函数声明和定义中参数赋值为0调用问题演示
- Python自定义函数的创建、调用和函数的参数详解
- Python自定义函数的创建、调用和函数的参数详解
- JNI调用c++函数,该函数的参数是结构体(——对象的传递)
- VC6.0通过ADO调用SQL Server 2000的存储过程出现参数过多的问题
- c++ 指针总结 函数参数指针调用和堆栈内存的分配原理