- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我从我的 View Controller 调用动画时,我试图在我的 View Controller 上调用 cocos3d 动画然后我收到错误。
"cocos2d: 使用 Director Type:CCDirectorTimer[错误] cocos23Layer 需要 Controller 来渲染 3D 场景。2013-08-29 11:54:56.419 MaskedCal[3854:c07] * -[cocos23Layer initWithController:],/Users/34in/Desktop/cocos23/cocos23/cocos23/cocos3d/cocos3d 断言失败/Scenes/CC3Layer.m:74 "
这是我的 View Controller ,我想在其中调用我的 cocos3d 动画
- (void)setupCocos2D {
EAGLView *glView = [EAGLView viewWithFrame:self.view.bounds
pixelFormat:kEAGLColorFormatRGB565 // kEAGLColorFormatRGBA8
depthFormat:0 // GL_DEPTH_COMPONENT16_OES
];
[[CCDirector sharedDirector] setOpenGLView:glView];
// Create the customized CC3Layer that supports 3D rendering.
CC3Layer* cc3Layer = [cocos23Layer node];
// cc3Layer = [cocos23Layer layerWithColor: ccc4(100, 120, 220, 255)];
//[cc3Layer scheduleUpdate];
// self.view = glView;
// [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
cc3Layer.cc3Scene = [cocos23Scene scene];
CC3ControllableLayer* mainLayer = cc3Layer;
//
// CCScene *scene = [CCScene node];
// [scene addChild: mainLayer];
// [[CCDirector sharedDirector] runWithScene: scene];
mainLayer.contentSize = CGSizeMake(2048, 1320);
[CCDirector sharedDirector].animationInterval = (1.0f / 60.0f);
[CCDirector sharedDirector].displayStats = YES;
[[CCDirector sharedDirector] enableRetinaDisplay: YES];
[[CCDirector sharedDirector] runWithScene:mainLayer];
}
*这是我的 cocos23scene 动画发生的地方 *
-(无效)初始化场景{
// Create the camera, place it back a bit, and add it to the scene
CC3Camera* cam = [CC3Camera nodeWithName: @"Camera"];
cam.location = cc3v( 0.0, 0.0, 6.0 );
[self addChild: cam];
// Create a light, place it back and to the left at a specific
// position (not just directional lighting), and add it to the scene
CC3Light* lamp = [CC3Light nodeWithName: @"Lamp"];
lamp.location = cc3v( -2.0, 0.0, 0.0 );
lamp.isDirectionalOnly = NO;
[cam addChild: lamp];
// This is the simplest way to load a POD resource file and add the
// nodes to the CC3Scene, if no customized resource subclass is needed.
[self addContentFromPODFile: @"hello-world.pod"];
// Create OpenGL buffers for the vertex arrays to keep things fast and efficient, and to
// save memory, release the vertex content in main memory because it is now redundant.
[self createGLBuffers];
[self releaseRedundantContent];
// Select an appropriate shader program for each mesh node in this scene now. If this step
// is omitted, a shader program will be selected for each mesh node the first time that mesh
// node is drawn. Doing it now adds some additional time up front, but avoids potential pauses
// as each shader program is loaded as needed the first time it is needed during drawing.
[self selectShaderPrograms];
// With complex scenes, the drawing of objects that are not within view of the camera will
// consume GPU resources unnecessarily, and potentially degrading app performance. We can
// avoid drawing objects that are not within view of the camera by assigning a bounding
// volume to each mesh node. Once assigned, the bounding volume is automatically checked
// to see if it intersects the camera's frustum before the mesh node is drawn. If the node's
// bounding volume intersects the camera frustum, the node will be drawn. If the bounding
// volume does not intersect the camera's frustum, the node will not be visible to the camera,
// and the node will not be drawn. Bounding volumes can also be used for collision detection
// between nodes. You can create bounding volumes automatically for most rigid (non-skinned)
// objects by using the createBoundingVolumes on a node. This will create bounding volumes
// for all decendant rigid mesh nodes of that node. Invoking the method on your scene will
// create bounding volumes for all rigid mesh nodes in the scene. Bounding volumes are not
// automatically created for skinned meshes that modify vertices using bones. Because the
// vertices can be moved arbitrarily by the bones, you must create and assign bounding
// volumes to skinned mesh nodes yourself, by determining the extent of the bounding
// volume you need, and creating a bounding volume that matches it. Finally, checking
// bounding volumes involves a small computation cost. For objects that you know will be
// in front of the camera at all times, you can skip creating a bounding volume for that
// node, letting it be drawn on each frame.
[self createBoundingVolumes];
// ------------------------------------------
// That's it! The scene is now constructed and is good to go.
// To help you find your scene content once it is loaded, the onOpen method below contains
// code to automatically move the camera so that it frames the scene. You can remove that
// code once you know where you want to place your camera.
// If you encounter problems displaying your models, you can uncomment one or more of the
// following lines to help you troubleshoot. You can also use these features on a single node,
// or a structure of nodes. See the CC3Node notes for more explanation of these properties.
// Also, the onOpen method below contains additional troubleshooting code you can comment
// out to move the camera so that it will display the entire scene automatically.
// Displays short descriptive text for each node (including class, node name & tag).
// The text is displayed centered on the pivot point (origin) of the node.
// self.shouldDrawAllDescriptors = YES;
// Displays bounding boxes around those nodes with local content (eg- meshes).
// self.shouldDrawAllLocalContentWireframeBoxes = YES;
// Displays bounding boxes around all nodes. The bounding box for each node
// will encompass its child nodes.
// self.shouldDrawAllWireframeBoxes = YES;
// If you encounter issues creating and adding nodes, or loading models from
// files, the following line is used to log the full structure of the scene.
LogInfo(@"The structure of this scene is: %@", [self structureDescription]);
// ------------------------------------------
// And to add some dynamism, we'll animate the 'hello, world' message
// using a couple of actions...
// Fetch the 'hello, world' object that was loaded from the POD file and start it rotating
CC3MeshNode* helloTxt = (CC3MeshNode*)[self getNodeNamed: @"Hello"];
CCActionInterval* partialRot = [CC3RotateBy actionWithDuration: 1.0
rotateBy: cc3v(0.0, 30.0, 0.0)];
[helloTxt runAction: [CCRepeatForever actionWithAction: partialRot]];
// To make things a bit more appealing, set up a repeating up/down cycle to
// change the color of the text from the original red to blue, and back again.
GLfloat tintTime = 8.0f;
ccColor3B startColor = helloTxt.color;
ccColor3B endColor = { 50, 0, 200 };
CCActionInterval* tintDown = [CCTintTo actionWithDuration: tintTime
red: endColor.r
green: endColor.g
blue: endColor.b];
CCActionInterval* tintUp = [CCTintTo actionWithDuration: tintTime
red: startColor.r
green: startColor.g
blue: startColor.b];
CCActionInterval* tintCycle = [CCSequence actionOne: tintDown two: tintUp];
[helloTxt runAction: [CCRepeatForever actionWithAction: tintCycle]];
最佳答案
是的,我已经让它工作了,只需从你的 View Controller 中调用它
CCTexture2D.defaultAlphaPixelFormat = kCCTexture2DPixelFormat_RGBA8888; //** COCOS3D 设置代码开始... **
// Create the customized CC3Layer that supports 3D rendering.
if( ! [CCDirector setDirectorType: kCCDirectorTypeDisplayLink] )
[CCDirector setDirectorType: kCCDirectorTypeDefault];
// Create the view controller for the 3D view.
_viewController = [CC3DeviceCameraOverlayUIViewController new];
_viewController.supportedInterfaceOrientations = UIInterfaceOrientationMaskAll;
_viewController.viewShouldUseStencilBuffer = NO; // Set to YES if using shadow volumes
_viewController.viewPixelSamples = 1; // Set to 4 for antialiasing multisampling
// Create the CCDirector, set the frame rate, and attach the view.
CCDirector *director = CCDirector.sharedDirector;
director.runLoopCommon = YES; // Improves display link integration with UIKit
director.animationInterval =(1.0f / kAnimationFrameRate);
director.displayFPS = YES;
director.openGLView = _viewController.view;
// Enables High Res mode on Retina Displays and maintains low res on all other devices
// This must be done after the GL view is assigned to the director!
[director enableRetinaDisplay: YES];;
//_viewController.view.backgroundColor=[UIColor cl];
[AvtaarImageview addSubview:_viewController.view];
CC3Layer* cc3Layer = [cocosnewLayer layerWithController: _viewController];
// Create the customized 3D scene and attach it to the layer.
// Could also just create this inside the customer layer.
cc3Layer.cc3Scene = [cocosnewScene scene];
// Assign to a generic variable so we can uncomment options below to play with the capabilities
CC3ControllableLayer* mainLayer = cc3Layer;
// The 3D layer can run either directly in the scene, or it can run as a smaller "sub-window"
// within any standard CCLayer. So you can have a mostly 2D window, with a smaller 3D window
// embedded in it. To experiment with this smaller embedded 3D window, uncomment the following lines:
// CGSize winSize = CCDirector.sharedDirector.winSize;
// cc3Layer.position = ccp(30.0, 30.0);
// cc3Layer.contentSize = CGSizeMake(winSize.width - 100.0, winSize.width - 40.0);
// cc3Layer.alignContentSizeWithDeviceOrientation = YES;
// mainLayer = [CC3ControllableLayer layerWithController: _viewController];
// [mainLayer addChild: cc3Layer];
// A smaller 3D layer can even be moved around on the screen dyanmically. To see this in action,
// uncomment the lines above as described, and also uncomment the following two lines.
// cc3Layer.position = ccp(0.0, 0.0);
// [cc3Layer runAction: [CCMoveTo actionWithDuration: 15.0 position: ccp(500.0, 250.0)]];
// Set the layer in the controller
_viewController.controlledNode = mainLayer;
// Run the layer in the director
CCScene *scene = [CCScene node];
[scene addChild: mainLayer];
[CCDirector.sharedDirector runWithScene: scene];
关于iphone - 我想用 uikit( Nib 或 Storyboard)设置 cocos3d,但我收到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18503801/
我已经使用 vue-cli 两个星期了,直到今天一切正常。我在本地建立这个项目。 https://drive.google.com/open?id=0BwGw1zyyKjW7S3RYWXRaX24tQ
您好,我正在尝试使用 python 库 pytesseract 从图像中提取文本。请找到代码: from PIL import Image from pytesseract import image_
我的错误 /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference
我已经训练了一个模型,我正在尝试使用 predict函数但它返回以下错误。 Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]])
根据Microsoft DataConnectors的信息我想通过 this ODBC driver 创建一个从 PowerBi 到 PostgreSQL 的连接器使用直接查询。我重用了 Micros
我已经为 SoundManagement 创建了一个包,其中有一个扩展 MediaPlayer 的类。我希望全局控制这个变量。这是我的代码: package soundmanagement; impo
我在Heroku上部署了一个应用程序。我正在使用免费服务。 我经常收到以下错误消息。 PG::Error: ERROR: out of memory 如果刷新浏览器,就可以了。但是随后,它又随机发生
我正在运行 LAMP 服务器,这个 .htaccess 给我一个 500 错误。其作用是过滤关键字并重定向到相应的域名。 Options +FollowSymLinks RewriteEngine
我有两个驱动器 A 和 B。使用 python 脚本,我在“A”驱动器中创建一些文件,并运行 powerscript,该脚本以 1 秒的间隔将驱动器 A 中的所有文件复制到驱动器 B。 我在 powe
下面的函数一直返回这个错误信息。我认为可能是 double_precision 字段类型导致了这种情况,我尝试使用 CAST,但要么不是这样,要么我没有做对...帮助? 这是错误: ERROR: i
这个问题已经有答案了: Syntax error due to using a reserved word as a table or column name in MySQL (1 个回答) 已关闭
我的数据库有这个小问题。 我创建了一个表“articoli”,其中包含商品的品牌、型号和价格。 每篇文章都由一个 id (ID_ARTICOLO)` 定义,它是一个自动递增字段。 好吧,现在当我尝试插
我是新来的。我目前正在 DeVry 在线学习中级 C++ 编程。我们正在使用 C++ Primer Plus 这本书,到目前为止我一直做得很好。我的老师最近向我们扔了一个曲线球。我目前的任务是这样的:
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我的网站中有一段代码有问题;此错误仅发生在 Internet Explorer 7 中。 我没有在这里发布我所有的 HTML/CSS 标记,而是发布了网站的一个版本 here . 如您所见,我在列中有
如果尝试在 USB 设备上构建 node.js 应用程序时在我的树莓派上使用 npm 时遇到一些问题。 package.json 看起来像这样: { "name" : "node-todo",
在 Python 中,您有 None单例,在某些情况下表现得很奇怪: >>> a = None >>> type(a) >>> isinstance(a,None) Traceback (most
这是我的 build.gradle (Module:app) 文件: apply plugin: 'com.android.application' android { compileSdkV
我是 android 的新手,我的项目刚才编译和运行正常,但在我尝试实现抽屉导航后,它给了我这个错误 FAILURE: Build failed with an exception. What wen
谁能解释一下?我想我正在做一些非常愚蠢的事情,并且急切地等待着启蒙。 我得到这个输出: phpversion() == 7.2.25-1+0~20191128.32+debian8~1.gbp108
我是一名优秀的程序员,十分优秀!