Commit Graph

20 Commits

Author SHA1 Message Date
Paul Gardiner 6b27f014fc Correct the Skybox fov (#16655)
* Remove undrawn quads from the skybox mesh

CCSkybox had been implemented using a combination of two
inconsistent techniques. The rendering was being achieved via use of
the vertex shader's inherent support for cubemaps. That technique requires
only a single screen-covering quad, but the implemtation defined a cube.
Defining a cube mesh would be appropriate if one were simply mapping the
cubemap's 6 textures to faces, but is unnecessary if using the shader's
cubemap feature.

Not only was the use of a cube mesh unnecessary, but the particular way
the cube was defined and used meant that only one face would ever
contribute to the rendering. One of the other faces would always be culled
and the other four would be viewed edge on, mapping the the infinitesimally
thin lines defining the edges of the screen.

This commit simply removes the never-rendered faces, and adds comments
explaining the technique.

* Within test code, remove setScale calls applied to skyboxes.

A Skybox is defined in such a way that it's position, rotation and
scaling has no effect on it's rendering, so setScale has no effect.
The calls are removed from test code to avoid confusing anyone using
it as a template for their own programs.

* Make the Skybox correctly account for the camera's fov

The Skybox does not use the model/view and projection matricies. Instead
a single quad that maps exactly to the screen is rendered and the camera's
world matrix is passed into a shader that renders using cubemap lookups.
The way that works hardwires the fov to 90deg in both the horizontal and
vertical. That shows up particularly badly when the camera is pointed
directly downwards and rotated: the image deforms as it rotates.

This commit corrects the problem by using scaling factors from the
camera's projection matrix to prescale the matrix passed into the shader.
2016-10-17 13:46:26 +08:00
Paul Gardiner 1c0602e130 Remove unnecessary arguments from some lua cc.mat4 methods (#16658)
* Lua: remove unused 3rd argument from cc.mat4.transformVector

cc.mat4.transformVector takes a mat4 and a 4vector and returns the result
of applying the mat4 to the vector. Strangely it had been made to also
require a third argument called dst which it doesn't use but did check
was a vec4. This commit allows cc.mat4.transformVector to be called
without the unnecessary argument. We still permit calling with it for
backward compatibility.

Also changed is the wrapper in Cocos2d.lua so that a second form of
cc.mat4.transformVector can be used where the vector is supplied as
4 separate numbers.

Changed the test files to call without the unnecessary argument.

* Lua: remove unused argument from cc.mat4.createTranslation/Rotation

Both these functions have an extra unnecessary argument called dst,
although neither use it either to pass in or out a value. This
commit removes the extra argument and updates the test programs
correspondingly.

Also, within Cocos2d.lua, remove some definitions that are later
overwritten by new ones
2016-10-08 14:33:50 +08:00
Paul Gardiner 68ec773f39 lua: generate bindings for Sprite3DMaterial (#16609)
Add Sprite3DMaterial to the list of classes for autogeneration of
lua bindings.

Add a new test case to the end of Sprite3DTest.lua showing the
use of outline.material.
2016-09-30 09:34:16 +08:00
songchengjiang dcfdfd3a78 LUA tests: add Sprite3DNormalMappingTest 2015-11-26 11:27:33 +08:00
samuele3hu c801d1868c Update Sprite3DTest and VideoPlayerTest about Lua 2015-04-28 11:27:50 +08:00
samuele3hu 51bcac9e84 Fix the bugs about cubeMap & Skybox lua test case and update the Android.mk about SpritePolygonTest 2015-04-28 09:17:00 +08:00
samuele3hu dd3b6ced34 Fix the bugs that title and button disappeared because of camera setting 2015-04-14 15:40:12 +08:00
samuele3hu 921981833e Update Sprite3DCubeMap test case 2015-03-28 14:59:47 +08:00
yangxiao 000e34c6d0 merge cocos 2015-03-26 12:50:18 +08:00
zhukaixy 52280e6376 add 3d test case(skybox and texture cube) for lua project 2015-03-20 17:53:05 +08:00
yangxiao 81bf776d09 do not use MoveTo::reserse 2015-03-13 14:10:51 +08:00
samuele3hu 80c2e0c153 Add AsyncLoadSprite3D test case and update the related lua binding 2015-01-28 21:47:52 +08:00
samuele3hu 115d81574c Add CameraTest、OBBTest and related lua bindings 2014-10-10 09:49:25 +08:00
samuele3hu 691074eb7c Add Camra3DTest and update sprite3DTest 2014-09-26 16:00:57 +08:00
samuele3hu f0608a6d70 Update lua bindings for Mesh and add a Sprite3DHitTest 2014-09-22 15:29:38 +08:00
samuele3hu ace0d05bd4 Fix the crash that CocoStudioGuiTest in the Linux platform and errors than Sprite3DTest 2014-07-14 15:28:52 +08:00
samuele3hu 320dc4737b Update Sprite3D test cases for Lua 2014-07-02 17:00:31 +08:00
samuele3hu 3a350e11ae Add Lua binding for Animation3D and Animate3D ,and add related test case 2014-06-19 14:05:38 +08:00
samuele3hu 6c8e38871c issue #5255:Remove Sprite3D effect test 2014-05-22 10:22:10 +08:00
samuele3hu 2d65f9bc6f issue #5255:Add Sprite3D test cases for Lua 2014-05-20 18:09:04 +08:00