MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / renderObject

Function renderObject

public/iframe/lib/js/CSS3DRenderer.js:176–244  ·  view source on GitHub ↗
( object, scene, camera, cameraCSSMatrix )

Source from the content-addressed store, hash-verified

174 }
175
176 function renderObject( object, scene, camera, cameraCSSMatrix ) {
177
178 if ( object instanceof THREE.CSS3DObject ) {
179
180 object.onBeforeRender( _this, scene, camera );
181
182 var style;
183
184 if ( object instanceof THREE.CSS3DSprite ) {
185
186 // http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/
187
188 matrix.copy( camera.matrixWorldInverse );
189 matrix.transpose();
190 matrix.copyPosition( object.matrixWorld );
191 matrix.scale( object.scale );
192
193 matrix.elements[ 3 ] = 0;
194 matrix.elements[ 7 ] = 0;
195 matrix.elements[ 11 ] = 0;
196 matrix.elements[ 15 ] = 1;
197
198 style = getObjectCSSMatrix( matrix, cameraCSSMatrix );
199
200 } else {
201
202 style = getObjectCSSMatrix( object.matrixWorld, cameraCSSMatrix );
203
204 }
205
206 var element = object.element;
207 var cachedObject = cache.objects.get( object );
208
209 if ( cachedObject === undefined || cachedObject.style !== style ) {
210
211 element.style.WebkitTransform = style;
212 element.style.transform = style;
213
214 var objectData = { style: style };
215
216 if ( isIE ) {
217
218 objectData.distanceToCameraSquared = getDistanceToSquared( camera, object );
219
220 }
221
222 cache.objects.set( object, objectData );
223
224 }
225
226 element.style.display = object.visible ? '' : 'none';
227
228 if ( element.parentNode !== cameraElement ) {
229
230 cameraElement.appendChild( element );
231
232 }
233

Callers 1

CSS3DRenderer.jsFile · 0.85

Calls 1

getObjectCSSMatrixFunction · 0.85

Tested by

no test coverage detected